Closed JeSuis closed 9 years ago
Hi @JeSuis, you just need to add this line var _ = require('underscore');
in all task files, where you are using underscore. :)
ah I was hoping to not to have to do that to keep it dry, o well, thanks for your reply!
unfortunately that's how javascript works :(
Hi, I'm having a similar issue and wondered if you could give some example code? For example, take this standard Grunt task config (when not using load-grunt-config):
var compass = require('compass-importer');
grunt.initConfig({
sass: {
options: {
importer: compass
},
...
}
})
If I were using load-grunt-config with a sass.js
task file, how/where would I put the var compass = require('compass-importer');
line?
Hi @matt-bailey,
// sass.js file:
var compass = require('compass-importer');
module.exports = {
options: {
importer: compass
},
...
};
I think something like this should work.
Thanks for getting back to me @SolomoN-ua. I was hoping it would be that simple, but I'd already tried that and it didn't work.
When I ran the task in debug mode I could see that in the Options object importer=undefined
. Let me know if you have any other thoughts.
First of all check if compass-importer
is installed and please provide your Gruntfile.js
, sass.js
files. It will be hard to investigate problem without this files.
Hi, did you fix this issue? if so , could you share it? I found the same problem
var sass = require('node-sass');
var compass = require('compass-importer');
var assetFunctions = require('node-sass-asset-functions');
...
sass:{
options: {
sourceMap: true,
importer: compass,
...
Running "sass:dist" (sass) task
Verifying property sass.dist exists in config...OK
Files: sass/site.scss -> css/site.css
Options: precision=10, sourceMap, importer=undefined,
With normal grunt setup I had this at the top of my grunt file which gets used in settings for tasks.
var _ = require('underscore');
After changing the setup as per instructions I get the error.
>> ReferenceError: _ is not defined
And it breaks all the tasks. The var gets set but I haven't been able to successfully pass it in.
It's not really specific to underscore/lodash, would happen with setting any var for use in any task.