I use NPM and Gulp for my package and build manager. I installed "gulp-sass" to support sass and "gulp -clean-css" so that I can @import css files inline. I write my SCSS files to "_frontend / scss / ** / *" and compile them into a single file as "assets / frontend / css / styles.css". In the output location, I have other important resource folders that are css siblings: fonts, img, and js.
My problem is that I cannot get the relative url () paths to be set correctly when I import the "* .css" file. However, this is normal when I import .scss files.
Here is my code (I selected the source files, error log, etc. to simplify the question):
GULPFILE.JS
gulp.task('styles', function() {
gulp.src(styles.src)
.pipe(sassGlob())
.pipe(cleanCSS({
processImport: true
}))
.pipe(rename('styles.css'))
.pipe(gulp.dest('../assets/frontend/css/'));
});
MAIN.SCSS
OK below
@import "font-awesome/scss/font-awesome.scss";
The output seems to come out with the correct relative paths. Output Example: url (../fonts/FontAwesome/fontawesome-webfont.eot? V = 4.6.1)
Below is NOT
@import '../node_modules/jquery-ui/themes/base/jquery-ui.css';
Example output: url (../node_modules/jquery-ui/themes/base/images/animated-overlay.gif) ^ ^ The above somehow adds "../node_modules".
I want him to somehow set this to "../img/vendor/jquery-ui/what/ever/i/like/here"
Here is my directory structure.
_frontend
├─fonts
│ ├─Beamstyle-Icons
│ └─Gotham-Light-Regular
├─node_modules
│ ├─jquery-ui
│ │ ├─scripts
│ │ └─themes
│ │ ├─base
│ │ ├─images
│ │ └─minified
│ │ └─images
│ └─ (other stuff...)
│
├─scripts
│ ├─app
│ └─vendor
└─scss
├─config
├─helpers
│ ├─classes
│ ├─functions
│ ├─mixins
│ └─placeholders
└─src
├─blocks
└─components
assets
└─frontend
├─css
├─fonts
├─img
│ ├─Beamstyle-Icons
│ ├─FontAwesome
│ └─Gotham-Light-Regular
└─js
It would be great if anyone could help with this.
source
share