question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SASS/LESS pre-compilation and altering generated file prefixes

See original GitHub issue

So 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:closed
  • Created 8 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wearskacommented, Jan 5, 2016

+1 Actually waiting for this to start using it. Can’t just write plain css… 😐

0reactions
angular-automatic-lock-bot[bot]commented, Sep 5, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found