Skip to content
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

SyntaxError: Unexpected token ILLEGAL when required from GruntFile #48

Closed
sentience opened this issue Jan 20, 2016 · 3 comments
Closed

Comments

@sentience
Copy link

I am using Grunt (with grunt-sass) to build my site’s CSS. I’ve used NPM to install normalize-scss, but when I require('normalize-scss') in my GruntFile.js, I get a SyntaxError:

Loading "GruntFile.js" tasks...ERROR
>> SyntaxError: Unexpected token ILLEGAL
>>     at exports.runInThisContext (vm.js:53:16)
>>     at Module._compile (module.js:404:25)
>>     at Object.Module._extensions..js (module.js:432:10)
>>     at Module.load (module.js:356:32)
>>     at Function.Module._load (module.js:311:12)
>>     at Module.require (module.js:366:17)
>>     at require (module.js:385:17)
>>     at Object.module.exports (/Users/kyank/code/impromelbourne.com.au/GruntFile.js:26:11)
>>     at loadTask (/Users/kyank/code/impromelbourne.com.au/node_modules/grunt/lib/grunt/task.js:325:10)
>>     at Task.task.init (/Users/kyank/code/impromelbourne.com.au/node_modules/grunt/lib/grunt/task.js:437:5)

NodeJS v5.0.0 on OS X 10.11.2.

Any idea what I might be doing wrong?

@sentience
Copy link
Author

OK, so what I was doing wrong was trying to require a SCSS file from a JS file. ;)

This worked for me in my GruntFile.js:

    sass: {
      options: {
        includePaths: [
          require('path').dirname(require.resolve('normalize-scss')),
          require('path').dirname(require.resolve('support-for'))
        ],

@JohnAlbin
Copy link
Owner

@sentience Ooh. That's a pretty good way to get the proper importPaths. I like it!

Related: #43 (comment)

@JohnAlbin
Copy link
Owner

Will follow up in #58.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants