-
Notifications
You must be signed in to change notification settings - Fork 381
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-sass doesn't seem to play nice with sass imports #1
Comments
Haha! Went to browse the code to see if I could add it in and saw that you take in an options param. The example I gave works as expected >_<. If I get the time I'll make a pull request for documentation. Edit: NEVERMIND it's in the documentation. I just needed some sleep... |
Awesome! I should update the docs. Thanks :) |
I ran into this same problem. The above fixed it, but I don't see anything in the documentation. |
It's the very last line of the README.md, but I'll make it more explicit. |
I realize now that it's in the documentation for node-sass. |
I guess for some clarity I've raised an issue on node-sass about it not 'adhering to spec' as sass-lang states that _partials.scss should not get compiled. link: sass/node-sass#215 |
86827e6 should take care of this for you. |
@dlmanning yes, @neilkinnish ping'd me that earlier today. Thanks for the gulp version 👍 |
6b65a31 adds extended documentation for imports and partials. |
I had the same problem. The includePaths has to be a separate directory for some reason. |
I don't have mine as a seperate directory and it works for me On Sunday, January 19, 2014, Jonathan Kemp notifications@github.com wrote:
|
https://github.com/webdesserts/webdesserts-www/blob/master/Gulpfile.js You can find my gulpfile there as an example. I didn't know about the On Sunday, January 19, 2014, Michael Mullins webdesserts@gmail.com wrote:
|
Small update: Thinking that, perhaps, the generally acceptable partial name shortening might be the problem, I swapped this @import "normalize"
@import "custom" …to this… @import "_normalize.sass"
@import "_custom.sass" …and got a different error:
However, I can't put a semicolon at the end of the @import directive. This is Sass, not Scss. |
Gulp-sass uses node-sass and in-turn lib-sass https://github.com/andrew/node-sass/blob/master/README.md I believe lib-sass does not support the sass syntax, only scss. If you want to to use the sass syntax, your best bet is to use a node On Sunday, January 19, 2014, Marc Amos notifications@github.com wrote:
|
Yeah it's using libsass which only supports the .scss flavour of sass. Also you don't need to prefix with _ when you import it will find them based on name, that just tells sass not to compile on its own and treat as a partial |
Thanks for the replies, folks. Any tips on getting Gulp to compile the older Sass syntax? I'm not sure I have the technical chops to use a node child-process, as @webdesserts points out. Or, I suppose I might try the gulp-ruby-sass plugin, that's probably what I'm looking for… |
marcamos: https://npmjs.org/package/gulp-ruby-sass is probably your best bet if you need to use the older sass syntax. My understanding is that libsass is never going to support it. |
Thanks @dlmanning. Yeah, I just came to that conclusion a moment before your reply. Thanks to all of you for the information! |
I haven't tried it, but the gulp-ruby-sass plugin is probably your best On Monday, January 20, 2014, Marc Amos notifications@github.com wrote:
|
Edit: FIXED, NOT A GULP-SASS ISSUE. Turns out libsass doesn't like the dot in the inuit.css directory name (plus another error within inuit but I submitted a PR to them for that) Has anyone had any success with nested style.scss Here's what I have: gulp.task('sass', function() {
gulp.src('./public/css/style.scss')
.pipe(sass({ includePaths: ['./public/css'], errLogToConsole: true }))
.pipe(gulp.dest('./public/css'));
}); But it errors the first time my own styles reference anything from inuit. Any ideas? |
@quagliero Can you post your solution, I’m having similar trouble compiling an inuit project. |
@jonhurrell In the end I got it working using that same snippet of code above. I had to make two changes on inuit though: one of them was changing the 'inuit.css' directory to be 'inuitcss', and the other you can see here (just escaping some variables properly) In the end due to the current issues with node-sass/libsass not handling What errors are you getting? |
No errors, I’ve replicated your directory structure, but the style.css doesn‘t contain any of the imports from inuit.css (despite) removing the '.' from the directory name. Only 'ui' partials and vars make the compile. |
@quagliero Switched to gulp-ruby-sass, straight compile after resolving interpolation issue. |
@jonhurrell I've just changed it back to node-sass to sanity check for myself! It still works. The only thing that caught me out this time was I'd forgotten to rename the inuit import Glad you're up and running with gulp-ruby-sass, I'm not really noticing much in the way of a speed issue with it. |
Have you guys filed issues with libsass about this '.' directory name problem? It's got nothing to do with gulp-sass itself. |
@webdesserts thanks for this 👍 |
@arnolali thanks, that fixed my problem on Windows |
@arnolali your solution fixed the issue here as well! <3 |
@arnolali Thanks! Fixed my problem on Windows 10 |
By the way, I'm not Mac (so, not Windows) and the only thing that fixed my problem here was to also set atomic_save to true on my SublimeText user settings. |
I'd just like to also send my thanks to @arnolali too... I was suffering for a while, but that has fixed it for me (windows 10/sublime) |
My thanks to you @arnolali I had the same issue with my gulp-sass task on saving, but your suggestion has solved the issue (windows 10/sublime text 3) |
@arnolali Thanks! |
Hey guys, in my base .scss file, I am importing the following modules in order of precedence to override the default behaviors.
But the css generated from my gulp process is not in the mentioned import order. Am I missing something? Here is my gulp process - 'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var gutil = require('gulp-util');
var size = require('gulp-size');
var rename = require('gulp-rename');
module.exports = {
doSass: function(){
gulp.src('./src/sass/app.scss')
.pipe(sass({outputStyle: 'compressed'}).on('error', gutil.log))
.pipe(rename('app-rm-md.min.css'))
.pipe(size({
title: "app-rm-md.min.css",
}))
.pipe(size({
title: "app-rm-md.min.css",
gzip: true
}))
.pipe(gulp.dest('./dist/css'));
},
watchSass: function(){
return gulp.watch('./src/**/*.scss', ['sass']);
}
}; What could be the possible fix, other than adding another CSS class? |
@shreeshkatyayan there were issues with ordering in old versions. Please update. |
@xzyfer I am presently using v2.3.1.. |
I will still be a problem after I add the gulpfile.js: gulp.task('styles', function() {
return gulp.src('src/sass/main.scss')
.pipe(sass({includePaths : ['src/sass']}))
.pipe(gulp.dest('dist/css'));
});
gulp.task('watch', function() {
gulp.watch('src/sass/**/*.scss', ['styles']);
}); src/sass/main.scss:
when i change error:
package.json "devDependencies": {
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-clean": "^0.3.2",
"gulp-compass": "^2.1.0",
"gulp-concat": "^2.6.0",
"gulp-connect": "^5.0.0",
"gulp-imagemin": "^3.0.3",
"gulp-jshint": "^2.0.1",
"gulp-minify-css": "^1.2.4",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.2",
"gulp-uglify": "^2.0.0",
"jshint": "^2.9.3"
} node-version : v5.10.1 |
@minhuang0 did you tried this? |
@arnolali @felipedefarias thanks, that fixed my problem ! |
O.K, this was driving me crazy, but I think I figured it out. I'm using an SSD for the operating system, but all my files including my projects are in in a separate Mechanical Drive, and I suspected because Lib-Sass is so fast that it's (for some reason) compiles the file faster than the save process is complete on files that's being imported, that's why it cant' see the @import "example" and throw this error. (or something like that, I'm just thinking out lout here) Anyway, I moved my project to the desktop (on the SSD), and it worked like a charm (even without doing the "atomic_save" trick on sublime, and I tested it thoroughly. I thought I would mention this solution in case someone was using another editor and has the same (SSD, HDD) situation. |
I have a similar problem. My config doesn't throw any errors. All the sass code in my file is compiled, but import statements are just ignored. Here is my config:
What can be the problem? Doesn't seem this is the same problem everybody has here. |
When importing in SASS modules, make sure your files have |
@Shaker-Hamdi Great idea! Basicly the right cause. So we can slow down the complie speed and code gulpfile like this:
It works fine for me! |
@xiaofuyesnew Works for me 2, Thanks |
@xiaofuyesnew Thank you very much, i think same way but dont know how to put SetTimeout function in task right, had to write return ))) All works fine, you help me to overcome so big problem. |
Getting the same error. Tried everything. |
@mittalyashu Did you try this ... |
@Shaker-Hamdi You mean to say that it does take the time to fetch the files from the hard drive before compiling it. |
@mittalyashu something like that, I'm just guessing. The only thing that worked for me was moving all my projects to the SSD. |
The scss/main.scss @import "base";
... scss/_base.scss // some styles Then,you can modify your ...
gulp.task('sass', function() {
return gulp.src('scss/main.scss') // only compiles main.scss
.pipe(sass())
.pipe(gulp.dest('dist/css'));
});
...
gulp.task('watch:sass', function() {
gulp.watch('scss/*.scss', ['sass']); // watching all .scss files
});
... May you success!>_< |
how to solve this problem in vs code ? |
@starfish7 Did you tried this? #1 (comment) |
@felipe-pita , yes, but the same problem ( gulp.task("styles", function() { |
I think you should try to update node-sass or use https://www.npmjs.com/package/gulp-wait to insert a delay before run .pipe(sass..) |
`Error in plugin "gulp-sass" gulp-sass 5 does not have a default Sass compiler; please set one yourself. var sass = require('gulp-sass')(require('sass')); [16:22:12] The following tasks did not complete: sassHandler hi~ How to solve this problem? |
Right now if any of my sass files have an
@import
in them I get an error like this:Where normalize is a
normalize.scss
in the same directory.This seems to be because you are using the data option without an includePaths.
This could maybe be solved with an includePaths option?
The text was updated successfully, but these errors were encountered: