Pass variables to Sass
See original GitHub issueHello,
Is it possible to pass any variables to the sass files ?
example:
gulp task:
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var sassConfig = require('./config').sass;
var fontsConfig = require('./config').fonts;
gulp.task('sass:dist', function () {
return gulp.src(sassConfig.mainSassFile)
.pipe($.sass())
.pipe($.preprocess({context: {PATH: '../../bower_components/foundation-icon-fonts/icons'}}))
.pipe($.concat('main.min.css'))
.pipe($.minifyCss())
.pipe(gulp.dest(sassConfig.dist.dest));
});
variable sass:
$fi-path: 'PATH';
Thanks for your help
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:6
Top Results From Across the Web
Variables - Sass
Sass variables are imperative, which means if you use a variable and then change its value, the earlier use will stay the same....
Read more >Passing values from HTML to SCSS - Stack Overflow
You can pass value from HTML to CSS class using css custom properties (variables). Here is working example : .fill-color { display: block; ......
Read more >How to Use Mixins in Sass and Pass Arguments – With Code ...
First we define a mixin using the @mixin at-rule. · Then we give it a name – choose whatever you think will fit...
Read more >Sass - Mixin Arguments - Tutorialspoint
Variable argument is used to pass any number of arguments to mixin. It contains keyword arguments passed to the function or mixin. Keyword...
Read more >Share variables between JavaScript and CSS
Here are all of the ways I know how to pass data back and forth ... Coupled with Sass variables, it allows you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @Keats Thanks for your help. I used the gulp-preprocess package. It allows to do that: .pipe($.preprocess(context: {PATH: ‘…/…/pathIconFontDevEnvironment’}}))
sass file:
@kiki-le-singe Why would you use preprocess after calling
sass()
? Shouldn’t it be the other way around?