davidguttman / cssify

Simple middleware for Browserify to add css styles to the browser.
122 stars 19 forks source link

Weird problem #6

Closed DjebbZ closed 10 years ago

DjebbZ commented 10 years ago

I'm build javascript code with the browserify API in a custom script. But it fails because of cssify. The css file I require is pretty simple and normal (10 lines, 3 classes declaration, no CSS2 or 3), with no weird encoding or line-ending chars. Here's the output I have in my build :

╰─$ ./build.js --file myScript.js

/home/djebbz/***/style.css:1
var css = 'var css = \'.my-class__my_element {\\
                                                                                      ^
ParseError: Unexpected token ILLEGAL

I tried something simple in the cssify code, in index.js. I replaced .replace(/\n/g, "\\\n") by .replace(/\n/g, "") and it worked. Of course it means the indentation in output is lost.

It seems, but I'm really not sure, that it's related to a bugfix in one of browserify dependencies, because I didn't have the problem before. See https://github.com/substack/node-browserify/issues/639 and the fix in the referenced project (creationix/mine).

I'm on Debian, latest browserify and cssify versions.

davidguttman commented 10 years ago

Are you still having this problem? I just tried with the latest browserify version, and the test passed.

Let me know if a) you still have the issue and if b) the current test passes. If (a) and (b) are true we'll have to make a new test to address this.

jeffling commented 10 years ago

Also had a weird problem.

require('ngProgress/ngProgress.css')

gave me ParseError: Unexpected token ILLEGAL

But the same css in require('test.css') worked.

MylesBorins commented 10 years ago

This is the same problem as #13

MylesBorins commented 10 years ago

I have solved the issue, please refer to #13

DjebbZ commented 10 years ago

I don't use cssify anymore, I can't tell if the fix in #13 works for me.