gruntjs - Specify SASS variable on compile with Grunt-Contrib-Sass -


Before compiling with Grant-Ferry-SAS, is it possible to specify a variable in SASS from GreatFile.JS?

For example, if the full path is required in the CSS, then the path based on dev build or deploy build Grantfile can be defined by.

For people familiar to, it will be at least equal to 'SASASS' ' Modified Wars .

Example Grunfile

  ... sass: {deploy: {vars: {absolute: "http://www.example.com/"}}, Dev: {Wars: {full: "/ local_path/"}}} ​​...  

example SASS

  .element {background-image: url ("# {Absolute} image.jpg"); }    

I understand grunts work only on saus preprocessor. There is nothing more than this that you can not pass the variable for the actual SASS from the gruntfile and expect that it should work. You can potentially use a compass to set a function that creates an environment variable and depending on that value you can create a SASS mix that changes the path based on that environment. As shown in this reply.

You can then set up configuration grunt file configuration.

  sass: {deploy: {options: {environment: "production"}}, dev: {option: {environment: "development"}}}  
< / Div>

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -