Gathering detailed insights and metrics for ember-cli-sass
Gathering detailed insights and metrics for ember-cli-sass
Gathering detailed insights and metrics for ember-cli-sass
Gathering detailed insights and metrics for ember-cli-sass
Use node-sass to preprocess your ember-cli app's files, with support for sourceMaps and include paths
npm install ember-cli-sass
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Node Version
NPM Version
274 Stars
268 Commits
91 Forks
20 Watching
11 Branches
52 Contributors
Updated on 04 Nov 2024
Minified
Minified + Gzipped
JavaScript (85.02%)
HTML (13.04%)
Handlebars (1.07%)
SCSS (0.87%)
Cumulative downloads
Total Downloads
Last day
-9%
10,592
Compared to previous day
Last week
-10.7%
55,966
Compared to previous week
Last month
15.4%
274,869
Compared to previous month
Last year
-3%
4,543,573
Compared to previous year
29
ember-cli-sass uses Sass to preprocess your ember-cli app's styles, and provides support for source maps and include paths. It provides support for the common use case for Ember.js projects:
outputPaths
configurationember install ember-cli-sass
If you want to use ember-cli-sass in an addon and you want to distribute the compiled CSS it must be installed as a dependency
so that addon/styles/addon.scss
is compiled into dist/assets/vendor.css
. This can be done using:
1npm install --save ember-cli-sass sass
By default this addon uses a distribution of Dart Sass that is compiled to pure JavaScript. Dart Sass is the reference implementation for Sass, but it does provides significantly slower compilation times than LibSass (via node-sass
).
If you would like to use an alternative implementation (e.g. node-sass
), you must
pass a Sass implementation to the sassOptions
config property in ember-cli-build.js
(or in Brocfile.js
if you are
using an Ember CLI version older than 1.13):
1var nodeSass = require("node-sass"); 2 3var app = new EmberApp({ 4 sassOptions: { 5 implementation: nodeSass, 6 }, 7});
By default this addon will compile app/styles/app.scss
into dist/assets/app.css
and produce
a source map for your delectation.
If you want more control, you can pass additional options to sassOptions
:
includePaths
: an array of include pathsonlyIncluded
: true/false whether to use only what is in app/styles
and includePaths
. This may helps with performance, particularly when using NPM linked modulessourceMap
: controls whether to generate sourceMaps, defaults to true
in development. The sourceMap file will be saved to options.outputFile + '.map'
extension
: specifies the file extension for the input files, defaults to scss
. Set to sass
if you want to use .sass
instead.passthrough
: an optional hash of broccoli-funnel configuration for files from the styles tree to be passed through to dist
If you need to process multiple files, it can be done by configuring the output paths in your ember-cli-build.js
:
1var app = new EmberApp({ 2 outputPaths: { 3 app: { 4 css: { 5 app: "/assets/application-name.css", 6 "themes/alpha": "/assets/themes/alpha.css", 7 }, 8 }, 9 }, 10});
Source maps work for reading with no configuration, but to edit the SASS in the Dev Tools you need to configure your Workspace:
Install some SASS:
1npm install --save foundation
Specify some include paths in your ember-cli-build.js
:
1var app = new EmberApp({ 2 sassOptions: { 3 includePaths: ["node_modules/foundation/scss"], 4 }, 5});
Import some deps into your app.scss:
1@import "foundation"; /* import everything */ 2/* or just import the bits you need: @import 'foundation/functions'; */
To compile SASS within an ember-cli addon, there are a few additional steps:
Include your styles in addon/styles/addon.scss
.
Ensure you've installed ember-cli-sass
and either sass
or node-sass
under dependencies
in your package.json
.
Define an included
function in your addon's index.js
:
1// in your index.js 2module.exports = { 3 name: "my-addon", 4 included: function (/* app */) { 5 this._super.included.apply(this, arguments); 6 }, 7};
If you omit this step, it will throw the following error:
Cannot read property 'sassOptions' of undefined
TypeError: Cannot read property 'sassOptions' of undefined
at Class.module.exports.sassOptions (~/my-plugin/node_modules/ember-cli-sass/index.js:43:48)
Make sure your dummy app contains an app.scss
If you run ember build dist
, your styles from addon/styles/addon.scss
should appear correctly in dist/assets/vendor.css
As an alternative to the above, some addons may choose to allow their SASS to be used in the parent app, rather than the compiled CSS. This has the advantage of easily allowing users to use and override your SASS. The steps for this setup are as follows:
addon/styles/addon.scss
, place them in
app/styles/your-addon-name.scss
. Document that your user can now add
@import 'your-addon-name';
to their app.scss
file. In the lines before this import
they can choose to override any variables your addon marks with
default.To re-use SASS definitions from an in-repo-addon within an in-repo-engine, you
need to add the in-repo addons' path to the includePaths
. So basically if you
have a directory layout like this (where common
is an in-repo addon):
app
└── lib
├── my-in-repo-engine
│ ├── addon
│ │ └── styles
│ │ └── addon.scss
│ └── index.js
└── common
└── app
└── styles
└── common
└── vars.scss
The app/lib/my-in-repo-engine/index.js
should look like this:
1const EngineAddon = require('ember-engines/lib/engine-addon'); 2 3module.exports = EngineAddon.extend({ 4 5 sassOptions: { 6 includePaths: ['lib/common/app/styles'] 7 }, 8 9 ... 10 11};
and then you can include the definitions inside the engines SASS files via:
1@import "common/vars";
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 9/15 approved changesets -- score normalized to 6
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
57 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More