jvandemo / generator-angular2-library

Yeoman generator to create an Angular library
MIT License
752 stars 122 forks source link

Build "Error: Octal literal in strict mode" when css with content:"\123" #119

Open fabriziodebortoli opened 7 years ago

fabriziodebortoli commented 7 years ago

In a library created with this generator (Thanks! It's awesome) I use a css like this:

.css-class:before {
    content: "\62";
}

Building with npm run build I have an error:

Starting 'rollup:fesm'...

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: Octal literal in strict mode
    at error (C:\Microarea\fabriziodebortoli\ng-icon\node_modules\rollup\dist\rollup.js:170:12)
    at Module.error$1 [as error] (C:\Microarea\fabriziodebortoli\ng-icon\node_modules\rollup\dist\rollup.js:8007:2)
    at tryParse (C:\Microarea\fabriziodebortoli\ng-icon\node_modules\rollup\dist\rollup.js:7710:10)
    at new Module (C:\Microarea\fabriziodebortoli\ng-icon\node_modules\rollup\dist\rollup.js:7745:14)
    at C:\Microarea\fabriziodebortoli\ng-icon\node_modules\rollup\dist\rollup.js:9495:17
    at process._tickCallback (internal/process/next_tick.js:109:7)

What can I try to do?

This is an example of library: https://github.com/fabriziodebortoli/ng-icon

tonivj5 commented 7 years ago

You could use useStrict: false to disable that check, writing that line here. I haven't tested it, but I think it will work you 👍

jvandemo commented 7 years ago

@fabriziodebortoli — Can you try to escape the value:

content: "\\62";

and let us know if that works? Thanks!

fabriziodebortoli commented 7 years ago

You could use useStrict: false to disable that check, writing that line here. I haven't tested it, but I think it will work you 👍

@xxxtonixxx thanks but this is only a workaround, I would like to resolve... And rollup documentation says: ES6 modules are always in strict mode, so you shouldn't disable this without good reason.

Edit: I wanted to try the same but the option "useStrict" in the "gulp-rollup" is not used...

fabriziodebortoli commented 7 years ago

@jvandemo - Escaping, build is ok but the icons will not be visible because the css "content" mapping will be wrong

NicoTuxx commented 7 years ago

Hi ! Same problem here, by importing bootstrap-sass : $icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/"; @import "~bootstrap-sass/assets/stylesheets/bootstrap";

xtoff commented 6 years ago

I also have this problem when importing bootstrap library. Any ideas how to handle this? If I escape all the value with "{number}" in bootstrap node_modules everything works, but I don't want to change things in my node_modules..