<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bruno Bastos Neves on Medium]]></title>
        <description><![CDATA[Stories by Bruno Bastos Neves on Medium]]></description>
        <link>https://medium.com/@brunobastosneves?source=rss-e692d3a58d01------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CU0FVRd_7yB1FHFpzrDtBw.jpeg</url>
            <title>Stories by Bruno Bastos Neves on Medium</title>
            <link>https://medium.com/@brunobastosneves?source=rss-e692d3a58d01------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 00:16:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@brunobastosneves/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Frontend workflow automation with Gulp]]></title>
            <link>https://medium.com/@brunobastosneves/frontend-workflow-automation-with-gulp-7d6644122270?source=rss-e692d3a58d01------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d6644122270</guid>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[automatization]]></category>
            <category><![CDATA[save-time]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Bruno Bastos Neves]]></dc:creator>
            <pubDate>Sat, 06 May 2023 14:28:37 GMT</pubDate>
            <atom:updated>2023-05-06T14:28:37.787Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9xiep6t-OkfrYYyu" /><figcaption>Photo by <a href="https://unsplash.com/@sortino?utm_source=medium&amp;utm_medium=referral">Joshua Sortino</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Frontend workflow automation is a critical aspect of front-end web development. It involves using tools and processes to streamline the frontend development process, making it more efficient and effective. One such tool that is widely used for frontend workflow automation is Gulp.</p><p>This article will talk about frontend workflow automation, how Gulp can be used to do that, and compare it with another automation tool called Grunt.</p><h4>What is Frontend Workflow Automation?</h4><p>Frontend workflow automation refers to the use of various tools and processes to automate the repetitive and time-consuming tasks involved in frontend development. These tasks can include things like compiling, concatenating, and minifying code, optimizing images, running unit tests, and automatically refreshing the browser when changes are made. By automating these tasks, developers can save time, reduce errors, and focus on more important aspects of their work.</p><h4>What is Gulp?</h4><p>Gulp is a popular open-source toolkit that helps automate repetitive tasks in the frontend development process. It is written in JavaScript and runs on Node.js, allowing developers to use JavaScript to automate their workflow. Gulp uses a simple and intuitive syntax and can be easily extended with plugins to perform a wide variety of tasks.</p><h4>How to Install Gulp and Its Dependencies?</h4><p>Before you can start using Gulp, you need to install it and its dependencies. Here are the steps to follow:</p><ol><li>Install Node.js and NPM on your computer if you haven’t already done so.</li><li>Create a new project directory and navigate to it using your command line interface.</li><li>Run the command “npm init” to create a new package.json file for your project.</li><li>Run the command “npm install gulp — save-dev” to install Gulp as a development dependency for your project.</li></ol><h4>How Gulp works</h4><p>Gulp tasks are usually put in a file called gulpfile.js, in the root directory of your project after you install Gulp as a project dependency.</p><p>To create tasks you should know the following basic functions:</p><ul><li>gulp.task(name, fn) — define the task with a name and a javascript function to run</li><li>gulp.run(tasks…) — it’s used to run the tasks with the max simultaneity possible.</li><li>gulp.watch(glob, fn) — will watch the files that you specified and run the function on every change.</li><li>gulp.src(glob) — return a readable stream</li><li>gulp.dest(folder) — return a writable stream, where the result files are saved.</li></ul><h4>Example of a Task Built in Gulp</h4><p>Here’s an example of a simple task you can build in Gulp to minify and uglify a JavaScript file.</p><pre>const gulp = require(&#39;gulp&#39;);<br>const uglify = require(&#39;gulp-uglify&#39;);<br>const rename = require(&#39;gulp-rename&#39;);<br><br>gulp.task(&#39;minify-js&#39;, function () {<br>  return gulp.src(&#39;src/lib/*.js&#39;)<br>    .pipe(uglify())<br>    .pipe(rename({suffix: &#39;.min&#39;}))<br>    .pipe(gulp.dest(&#39;dist&#39;));<br>});</pre><p>In this example, we first require the Gulp module and the necessary plugins (uglify and rename). We then create a new task called “minify-js” that takes all the JavaScript files from the “/src/lib” folder, minifies all using the uglify plugin, rename them with a “.min” suffix using the rename plugin, and saves the result in the “dist” directory.</p><h4>Gulp vs. Grunt</h4><p>Gulp and Grunt are both popular tools for frontend workflow automation, but they differ in several ways. Gulp is known for its simplicity and speed, as it uses a code-over-configuration approach and streams data through its pipelines. Grunt, on the other hand, uses a more configuration-heavy approach and requires more setup time. Gulp also has a larger ecosystem of plugins and is more flexible in terms of how tasks can be composed.</p><h4>Gulp vs. Webpack</h4><p>Gulp and Webpack are both popular tools for frontend workflow automation, but they differ in several ways. Here are some key differences between Gulp and Webpack:</p><ol><li>Task-based vs. Module-based: Gulp is task-based, meaning that it uses a series of tasks to automate repetitive tasks in the frontend development process. Webpack, on the other hand, is module-based, meaning that it uses a module bundler to combine multiple modules into a single file.</li><li>Code-over-configuration vs. Configuration-heavy: Gulp uses a code-over-configuration approach, where developers write code to specify what tasks should be run and how data should be processed. Webpack, on the other hand, uses a configuration-heavy approach, where developers create configuration files to specify how modules should be bundled and processed.</li><li>Flexibility vs. Opinionated: Gulp is more flexible than Webpack, as it allows developers to use any plugin they want and compose tasks in any way they want. Webpack is more opinionated, as it comes with its own set of plugins and loaders and enforces a specific workflow.</li><li>Speed vs. Performance: Gulp is known for its speed, as it uses streams to process data and can run tasks in parallel. Webpack is known for its performance, as it can optimize and bundle modules for production use.</li></ol><p>They have different approaches and strengths. Gulp is more flexible and faster, while Webpack is more opinionated and performs better. Which one to use depends on the specific needs and preferences of the project and the development team.</p><p>It is possible to use Gulp with Webpack. In fact, this is a common approach that many developers use to get the best of both worlds. Here are some scenarios where using Gulp with Webpack can be useful:</p><ol><li>Complex Build Processes: If your project requires a complex build process that involves multiple tasks and tools, it can be easier to use Gulp to orchestrate everything. Gulp can run Webpack as a task and use its output for further processing, such as minification or optimization.</li><li>Customized Workflow: If you want to customize your frontend development workflow beyond what Webpack provides out of the box, Gulp can be a good choice. Gulp allows you to create your own tasks and use any plugins you want to process data, while still leveraging the power of Webpack to bundle and optimize modules.</li><li>Legacy Projects: If you have an existing project that already uses Gulp, it can be easier to integrate Webpack into your workflow using Gulp than to switch to Webpack completely.</li><li>Incremental Migration: If you want to migrate an existing project from Gulp to Webpack, you can do it gradually by integrating Webpack tasks into your Gulp workflow. This allows you to keep your existing Gulp tasks and plugins while slowly transitioning to Webpack.</li></ol><h4>Conclusion</h4><p>Frontend workflow automation is an essential tool that frontend developers should put their hands in to save time.</p><p>Gulp is a popular tool that can help automate repetitive tasks in the front-end development process. With its simple syntax and flexible plugin architecture, Gulp can save developers time and effort, allowing them to focus on more important aspects of their work. It can be used together with WebPack for leverage with successful complex build processes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d6644122270" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EPPlus excel library problems with HTTPS]]></title>
            <link>https://medium.com/@brunobastosneves/epplus-excel-library-problems-with-https-5002dd7ec5f4?source=rss-e692d3a58d01------2</link>
            <guid isPermaLink="false">https://medium.com/p/5002dd7ec5f4</guid>
            <dc:creator><![CDATA[Bruno Bastos Neves]]></dc:creator>
            <pubDate>Mon, 28 Nov 2022 13:47:44 GMT</pubDate>
            <atom:updated>2022-11-28T13:48:51.538Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*5-UONvc0GdVy8AI9GRxYfg.png" /></figure><p>EPPlus is a powerful open-source library for C# that makes working with Excel a breeze. This library is easy to use and easy to extend, making it the perfect tool for a wide range of Excel-related tasks. Whether you’re looking to create, edit, or export Excel files, EPPlus is the library for you.</p><p>This small article will not enter into details about how to install and generate an Excel file in a .Net project, but will actually talk about a problem regarding HTTP images when you need to serve an Excel file over an HTTPS website.</p><h3>The Problem</h3><p>When you have an Excel file generated over an SSL connection (HTTPS website for example) and you load an image to use in the Excel file using an HTTP connection you got mixed content between HTTPS and HTTP which is not enabled and heads to throw a network error in when downloading the result file.</p><p>Until yesterday, we do not have this problem because on the server every call and every image is served over HTTPS. But we update all dev&#39;s environments to also use HTTPS when working in localhost env.</p><p>After changing the web config to use SSL connections and cookies we start to have this problem because the images are loading directly from the storage:</p><pre>public void AddCompanyLogo(ExcelWorksheet worksheet)<br>    {<br>        worksheet.Row(1).Height = 37;<br>        worksheet.Column(1).Width = 24;<br><br>        string path = HttpContext.Current.Server.MapPath(&quot;~/images/logo_excel.jpg&quot;);<br>        var excelImage = worksheet.Drawings.AddPicture(&quot;Company Logo&quot;, path);<br>        excelImage.SetPosition(0, 0, 0, 0);<br>    }</pre><p>The code above shows the problem, add a picture using path loads the image in an HTTP context.</p><h3>The Solution</h3><p>To solve the issue I found that the AddPicture method of the EPPlus library had some signatures that enable the dev to send different types of content to be rendered.</p><pre>public ExcelPicture AddPicture(string Name, string ImagePath);<br>public ExcelPicture AddPicture(string Name, Stream pictureStream, ePictureType pictureType, Uri Hyperlink);<br>public ExcelPicture AddPicture(string Name, string ImagePath, ExcelHyperLink Hyperlink);<br>public ExcelPicture AddPicture(string Name, FileInfo ImageFile, Uri Hyperlink);<br>public ExcelPicture AddPicture(string Name, FileInfo ImageFile);<br>public ExcelPicture AddPicture(string Name, Stream PictureStream, ePictureType PictureType);</pre><p>To solve the problem, we only need to use a Stream, wich will contain the picture data in the memory.</p><pre>public void AddMagniLearnLogo(ExcelWorksheet worksheet)<br>    {<br>        worksheet.Row(1).Height = 37;<br>        worksheet.Column(1).Width = 24;<br><br>        string path = HttpContext.Current.Server.MapPath(&quot;~/images/logo_excel.jpg&quot;);<br>        Image img = Image.FromFile(path);<br><br>        Stream imgStream = new System.IO.MemoryStream();<br>        img.Save(imgStream, ImageFormat.Jpeg);<br>        imgStream.Position = 0;<br><br>        var excelImage = worksheet.Drawings.AddPicture(&quot;Magnilearn&quot;, imgStream, OfficeOpenXml.Drawing.ePictureType.Jpg);<br>        excelImage.SetPosition(0, 0, 0, 0);<br>    }</pre><p>The code above has the needed changes to call AddPicture with a Stream parameter. We follow these steps:</p><ol><li>Load the image by its path, as we did before;</li><li>Initialize the Stream;</li><li>Put the image which has a jpeg format into the stream using Save extension method;</li><li>Call the AddPicture with the correct parameters</li></ol><p>Note that the last parameter is the enum OfficeOpenXml.Drawing.ePictureType.Jpg which has the type of the need image by the EPPlus engine.</p><p>That way, the EPPlus receive a Stream from the application memory and avoid HTTPS/HTTP mixed content problems.</p><h3>Conclusion</h3><p>I hope that it helps other developers to find a fast path to solving this problem because you need some knowledge about mixed content to realize where the bug resides. The error is not so easy to be visualized at the first sight.</p><p>Maybe in another article, I can show how to build and entire Excel file with the library.</p><p>Thanks for reading, good bye!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5002dd7ec5f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>