giowe / gulp-sass-vars Goto Github PK
View Code? Open in Web Editor NEWInject variables in sass files
Inject variables in sass files
I cannot build my project anymore with the latest version of the package.
I get the following error message:
`gulp-sass-vars: Injected 1 variables to sass:
$output-bourbon-deprecation-warnings: 'false';
node_modules/source-map/lib/source-map-generator.js:277
throw new Error('Invalid mapping: ' + JSON.stringify({
^
Error: Invalid mapping: {"generated":{"line":1,"column":29271},"source":"../../../../../../node_modules/bourbon-neat/app/assets/stylesheets/grid/_span-columns.scss","original":{"line":89,"column":-353},"name":null}`
The error appears in conjuction wiht node-neat, my task looks like this:
gulp.task(
css:${publication.name}, () => { return gulp.src(
${config.paths.scss}/styles.scss) .pipe(gulpif(process.env.watch === 'true', plumber({errorHandler: onWatchError}))) .pipe(newer({ dest:
${config.paths.target}/css/styles.css, extra: extraFiles })) .pipe(sourcemaps.init()) .pipe(sassVars(vars)) .pipe(sass({ outputStyle: 'expanded', includePaths: ['css:' + publication.name].concat(normalize, neat), errLogToConsole: true })) .pipe(sourcemaps.write('./')) .pipe(gulp.dest(
${config.paths.target}/css)) .pipe(touch()); })
If I go back to v1.1.0 everything works fine.
If I try to inject per example 'font-family': 'Garamond, serif'
it gets injected as $font-family: "Garamond, serif";
which the browser then interprets as one font. Not sure how this could be worked around, is there an option to pass maybe so that parse-sass-value
doesn't autoquote things? I wouldn't mind having to quote things myself.
Hi there,
I provide variables via .json like "primaryColor" : "rgb(255,179,0)".
I recently updated my packages and unfortunately the task doesn't work as expected.
[14:52:34] $primaryColor: "rgb(255,179,0)";
[14:52:34] $secondaryColor: "#232323";
In the css-file it is like color: "#232323". The quotes are wrong.
IDK if it's by design, but I can't inject numbers, booleans or Objects.
// gulpfile.js
const gulp = require("gulp");
const sass = require("gulp-sass");
const vars = require("gulp-sass-vars");
const settings = {
url: {
base: "http://localhost:8080/",
img: {
avatar: "http://localhost:8080/img/avatar.svg"
}
}
};
gulp.task("style:transpile", transpileStyle);
function transpileStyle() {
gulp.src("./style.scss")
.pipe(vars(settings))
.pipe(sass())
.pipe(gulp.dest("./"));
}
// style.scss
@function image($alias) {
$images: map-get($url, 'img');
@return url('#{map-get($images, $alias)}');
}
.avatar {
background-image: image(avatar);
}
I've fixed this locally and will be glad to make a pull-request ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.