SASS/LESS pre-compilation and altering generated file prefixes
See original GitHub issueSo I was looking at adding SASS compilation to the build process of this. Typically in the past I’ve been telling it to compile particular files (app.scss and vendor.scss) but with ng2 and it’s Shadow DOM style encapsulation I guess it’s going to make sense to have a .SCSS per component.
I suppose my issue is that alongside this, we need a way to alter the pre-generated .css to have a .scss prefix instead.
SASS compilation was achieved (for anyone else interested):
/* global require, module */
var Angular2App = require('angular-cli/lib/broccoli/angular2-app');
var compileSass = require('broccoli-sass');
var mergeTrees = require('broccoli-merge-trees');
var _ = require('lodash');
var glob = require('glob');
module.exports = function(defaults) {
var app = new Angular2App(defaults);
var app = app.toTree();
var styles = mergeTrees(_.map(glob.sync('src/**/*.scss'), function(sassFile) {
sassFile = sassFile.replace('src/', '');
return compileSass(['src'], sassFile, sassFile.replace(/.scss$/, '.css'));
}));
return mergeTrees([styles, app], { overwrite: true });
}
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Sass vs. Less | CSS-Tricks
With either language, you can write your own mixins to help with vendor prefixes. No winner there. But you know how you don't...
Read more >CSS Preprocessors – Sass vs Less vs Stylus (With Examples)
We will talk about CSS Preprocessors and will discuss the 3 most important ones i.e. Sass vs LESS vs Stylus with examples around...
Read more >Sass: Syntactically Awesome Style Sheets
CSS with superpowers. Sass is the most mature, stable, and powerful professional grade CSS extension language in the world.
Read more >Sass, SCSS, and Less | IntelliJ IDEA Documentation - JetBrains
IntelliJ IDEA creates a separate file with the generated output. The file has the name of the source Sass, Less, or SCSS file...
Read more >Getting started | Less.js
Less extends CSS with dynamic behavior such as variables, mixins, operations and functions. Less runs on both the server-side (with Node.js and Rhino)...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
+1 Actually waiting for this to start using it. Can’t just write plain css… 😐
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.