<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Le Libre Au Quotidien</title>
    <description>The latest articles on DEV Community by Le Libre Au Quotidien (@llaq).</description>
    <link>https://dev.to/llaq</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F668208%2F9f47d9db-e890-40d6-a098-ce902d6c6c9b.png</url>
      <title>DEV Community: Le Libre Au Quotidien</title>
      <link>https://dev.to/llaq</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/llaq"/>
    <language>en</language>
    <item>
      <title>Compile SCSS with Gitlab CI/CD</title>
      <dc:creator>Le Libre Au Quotidien</dc:creator>
      <pubDate>Fri, 16 Jul 2021 17:52:08 +0000</pubDate>
      <link>https://dev.to/llaq/compile-scss-with-gitlab-ci-cd-5gj3</link>
      <guid>https://dev.to/llaq/compile-scss-with-gitlab-ci-cd-5gj3</guid>
      <description>&lt;p&gt;This article is also published in french on my personal blog: &lt;a href="https://lelibreauquotidien.fr/2021/01/12/compiler-du-scss-avec-gitlab-ci-cd/"&gt;https://lelibreauquotidien.fr/2021/01/12/compiler-du-scss-avec-gitlab-ci-cd/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hello World !&lt;/p&gt;

&lt;p&gt;I use a css preprocessor to make my work easier and especially to gain in code readability, but the problem is that it's quite boring to compile the css and put it in a release (time I could spend doing something productive (or not)).&lt;/p&gt;

&lt;p&gt;I host my code on the gitlab instance of framasoft (framagit), the advantage of gitlab is that it comes with a system that allows continuous integration.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The goal is to build, test and release software faster.&lt;br&gt;
&lt;em&gt;Source : Wikipedia&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So let's see how to use this in practice.&lt;/p&gt;

&lt;p&gt;To do continuous delivery with gitlab, you just have to create a file named .gitlab-ci.yml and fill in the necessary information.&lt;/p&gt;

&lt;p&gt;I will not waste time, I will give you the code now:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stages:
- compile
compile:
stage: compile
image: node:14.15.1-alpine3.10
script:
- yarn global add node-sass
- mkdir css/
- node-sass --output-style compressed ./file.scss &amp;gt; css/file.min.css
- node-sass ./file.scss css/file.css
artifacts:
paths:
- ./css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I imagine that if you are not initiated, this code does not tell you anything, so I will explain it to you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Line 1 and 2: Tells gitlab that there will be a compilation step.&lt;/li&gt;
&lt;li&gt;Line 4 and 5: Tells gitlab that the "compile" step is starting&lt;/li&gt;
&lt;li&gt;Line 6 : We indicate that the docker image to use (yes, gitlab cd works with docker) is an image of alpine (a light linux distribution) with nodeJS preinstalled&lt;/li&gt;
&lt;li&gt;Line 7 : Start the script&lt;/li&gt;
&lt;li&gt;Line 8 : Install sass with yarn&lt;/li&gt;
&lt;li&gt;Line 9 : We create a folder to distribute the compiled files.&lt;/li&gt;
&lt;li&gt;Line 10 and 11: We compile the file .scss (or .sass) in compressed and uncompressed version&lt;/li&gt;
&lt;li&gt;Line 12,13 and 14 : We indicate to gitlab that the compiled files are in the folder css/&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can save the file, the "pipeline" that could be translated as a compilation of our file will start.&lt;/p&gt;

&lt;p&gt;This pipeline will be launched after each commit and you can check the status of your pipelines in the CI/CD &amp;gt; Pipelines menu.&lt;/p&gt;

&lt;p&gt;Finally, to download the 2 files, you can use this menu and click on "compile":&lt;/p&gt;

&lt;p&gt;This is the end of this article, thanks for reading it and don't hesitate to give me feedback in the comments ;).&lt;/p&gt;

&lt;p&gt;Cover image by James Osborne on Pixabay&lt;/p&gt;

</description>
      <category>saas</category>
    </item>
  </channel>
</rss>
