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

Why the extra RawPlugin when importing StylesUrl? #6

Open
davidanaya opened this issue Jun 18, 2017 · 1 comment
Open

Why the extra RawPlugin when importing StylesUrl? #6

davidanaya opened this issue Jun 18, 2017 · 1 comment
Labels

Comments

@davidanaya
Copy link

Hi Alex, thanks for the plugin, it looks very promising.

I'm sorry to ask here but there's not much support for fusebox still out there.
I'm using your plugin to use templateUrl and stylesUrl in my app and with my configuration

plugins: [
    [SassPlugin(), CSSPlugin()],
    CSSPlugin(),
    Ng2TemplatePlugin()
]

I see in my bundled app.js that the regular imports have been converted to

AppComponent = __decorate([
    core_1.Component({
        selector: 'app',
        template: '\n    <arc-form></arc-form>\n  ',
        styles: [require('./app.component.scss')],
        encapsulation: core_1.ViewEncapsulation.None
    }),

so, my template has been imported directly and the styles transformed to a require.
As I already have [SassPlugin(), CSSPlugin()], configured, shouldn´t this work already as it is?

Why do you recommend to use RawPlugin instead?

    plugins: [
        Ng2TemplatePlugin(),
        ['*.component.html', RawPlugin()],
        ['*.component.css', RawPlugin()]
     //   or with a css pre/post processor...
     // ['*.component.css', PostCss([precss()]), RawPlugin()]   
    ]

Thanks!

@alex-klock
Copy link
Owner

Hi!

I believe this is needed to allow the stylesheet to be imported as a JavaScript module. The module itself gets converted to a JavaScript string, which is then required in the templateUrl property of the component.

It may not be needed so if you observed otherwise feel free to let me know :). Might just be the stage I ended up in during some trial and fire getting it to work.

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

No branches or pull requests

2 participants