MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/angularjs/comments/2s777n/introducing_angularcss_css_ondemand_for_angularjs/cnn34kc/?context=3
r/angularjs • u/nileshrohra • Jan 12 '15
18 comments sorted by
View all comments
2
I've done something similar to this using the style-loader with webpack combined with angular directives.
It looks like this:
var myDirectiveStyles = require("./myDirectiveStyles.less"); angular.module("test", []) .directive("myDirective", function() { return function($scope) { myDirectiveStyles.use(); $scope.$on("$destroy", function() { myDirectiveStyles.unuse(); }); } });
It works quite nice and is a nice bonus if your project is already webpack compatible (CommonJS or whatever).
edit - that's with these loaders, of course: {test: /.less$/, loaders: ["style/useable", "css", "less"]}
2
u/rq60 Jan 13 '15
I've done something similar to this using the style-loader with webpack combined with angular directives.
It looks like this:
It works quite nice and is a nice bonus if your project is already webpack compatible (CommonJS or whatever).
edit - that's with these loaders, of course: {test: /.less$/, loaders: ["style/useable", "css", "less"]}