Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gulp taksk in root element #1

Open
Mteixeira88 opened this issue Feb 20, 2018 · 1 comment
Open

gulp taksk in root element #1

Mteixeira88 opened this issue Feb 20, 2018 · 1 comment

Comments

@Mteixeira88
Copy link

Gulp vars

Expected Behavior

It should be possible to have an option that enables to choose where are the variables and watch when they change a value during the css file to change the variable to the new value.

.holder {
--some-variable: green;
background-color: var(holder-variable);
}

.trigger {
--some-variable: blue;
}

Actual Behavior

It only enables to have variables on root element.

:root {
--some-variable: blue;
--some-variable2: red;
}

@yepninja
Copy link
Owner

Thank you for using!

Actually, this plugin is outdated. And it's better for you to use postcss via gulp-postcss and postcss-css-variables plugin.

Just install it:
npm install --save-dev gulp-postcss postcss-css-variables
And use like so:

var gulp = require('gulp');
var postcss = require('gulp-postcss');
var cssvariables = require('postcss-css-variables');

gulp.task('css', function () {
    var plugins = [
        cssvariables()
    ];
    return gulp.src('./src/*.css')
        .pipe(postcss(plugins))
        .pipe(gulp.dest('./dest'));
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants