Reputation: 29109
I'm trying to prefix my images in my scss files, for example in my scss file I have
background-image: image-url('/img/bg.png')
which should be transformed in the css file to
background-image: url('/barfoo/img/bg.png');
In my gulpfile.js I have my styles task defined as follows:
var _sass = gulp.src('../scss/main.scss')
.pipe($.sass({
errLogToConsole: true,
imagePath: '/barfoo/'
}))
.pipe($.autoprefixer('last 2 versions'));
The problem is now that when I run this task and check the generated css file I get
background-image: url('/img/bg.png')
No prefixed path. I don't get any errors. Any suggestions what might go wrong here ?
Upvotes: 2
Views: 3732
Reputation: 5415
I think, you should apply another gulp plugin after compiling sass to css:
checkout this: https://www.npmjs.org/package/gulp-css-url-adjuster/
Upvotes: 2