Skip to content

bug: Throws an error if scss-file is empty #10

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

Closed
m-abs opened this issue Sep 27, 2016 · 1 comment
Closed

bug: Throws an error if scss-file is empty #10

m-abs opened this issue Sep 27, 2016 · 1 comment

Comments

@m-abs
Copy link
Contributor

m-abs commented Sep 27, 2016

We have a number of empty files in our project and we got this error when we tried to move to sass

TypeError: Cannot read property 'css' of undefined
    at /home/mabs/project/LYT3/nativescript/node_modules/nativescript-dev-sass/lib/converter.js:74:39
    at Object.module.exports.render (/home/mabs/project/LYT3/nativescript/node_modules/nativescript-dev-sass/node_modules/node-sass/lib/index.js:376:5)
    at parseSass (/home/mabs/project/LYT3/nativescript/node_modules/nativescript-dev-sass/lib/converter.js:58:8)
    at loopSassFilesAsync (/home/mabs/project/LYT3/nativescript/node_modules/nativescript-dev-sass/lib/converter.js:32:9)
    at /home/mabs/project/LYT3/nativescript/node_modules/nativescript-dev-sass/lib/converter.js:41:13
    at /home/mabs/project/LYT3/nativescript/node_modules/nativescript-dev-sass/lib/converter.js:76:9
    at /home/mabs/.nvm/versions/node/v6.5.0/lib/node_modules/nativescript/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:99:16
    at /home/mabs/.nvm/versions/node/v6.5.0/lib/node_modules/nativescript/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:123:15)

The problem is that the var output in nativescript-dev-sass/lib/converter.js:32 is undefined, but you only check for null

I've made a temporary fix in our end, by adding dummy css to all the files. (our setup doesn't allow removal of the files)

@m-abs m-abs changed the title bug: Throughs an error when scss-file is empty bug: Throws an error if scss-file is empty Oct 7, 2016
@jacobedawson
Copy link

This is exactly the problem that I encountered over the past 3 days (I'm new to NativeScript). The error is very cryptic and led to a couple of hours of adding & remove folders & files trying to identify the issue.

Like @m-abs suggested, even something as simple as placing a random comment at the top of the .scss / .sass file solves this problem:

/* comment */

I'm sure a lot of newcomers to NativeScript (especially those coming from the web with heavy usage of Sass) are going to run across this issue...

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