Monday, 15 February 2010

Create a bash script to compile SCSS into CSS that takes arguments -


How do I create a Bash script for compiling CSS in CSS which works with different file names and paths Does it?

For example, I am running this command to compile my SCSS file into a separate directory in a CD file:

  sass test.scss ./css/test2 CSS  

It's hard to run and again, so what can I do to make it a little easier? I'm new to booting scripting.

what you are looking for

  #! / Bin / bash f = $ {1: -test} sass $ {f} .scss ../css/$ {f} .css  

this script runs sass FILENAME Is scss ../css/FILENAME.css . If FILENAME (without extension) is set by the first argument then this is the default for test you can easily update more than one input file to make it easy Are there.

But you are not going to save a lot of time because you still have to call that code instead of sass Anything else is not complete by changing the command is.

The same file or !! > Instead of re-running the last sauce command, ! Use Sass View the previous command again in Bash History .

How To Use:
Save this script to a file, say xx .
Make Xx executable: chmod u + x xx
Run it without argument on trial: . Run it with a filename without the Xx
extension: ./xx myscssfile

Here is another version that will input a list of filenames or As the default test.scss will take:

  #! / Bin / bash functions dosas {if [$ # -EC 0]; Then return; Fi b = $ {1% .scss} sass $ b.scss ../css/$b.css} if [$ # -EC 0]; Then deselect "test.scss" for "F"; Dosage $ F;  

No comments:

Post a Comment