Skip to content

asnowwolf/css-with-mapping-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

css-with-mapping loader for webpack

Usage

var result = require('css-with-mapping-loader!css-loader!sass-loader!./test.scss');
// => returns sass rendered to CSS with /*# sourceURL=... */ and /*# sourceMappingURL=... */.

Use Case

In some cases (e.g. Angular2 Component Styles) you need to have style as a string.

You can cast the require output to a string, e.g.

@Component({
    selector: 'my-css-test',
    template: '<div>some content</div>',
    styles: [
        require('css-with-mapping!css!sass!./test.scss') // Of course, you will certainly configure the loader in the webpack configuration
    ]
})

** Note that the current version of Angular (2.4.5) will lose the sourceURL and sourceMappingURL comment, so unless you patch the code for Angular, otherwise the loader will not work properly. Follow Pull Request angular/angular#14175 for more information **

About

CSS to string loader with source mapping

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published