Gathering detailed insights and metrics for ember-cli-postcss-glimmer
Gathering detailed insights and metrics for ember-cli-postcss-glimmer
Gathering detailed insights and metrics for ember-cli-postcss-glimmer
Gathering detailed insights and metrics for ember-cli-postcss-glimmer
npm install ember-cli-postcss-glimmer
Typescript
Module System
Min. Node Version
Node Version
NPM Version
Handlebars (44.86%)
JavaScript (44.26%)
CSS (5.52%)
HTML (5.36%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
110 Stars
938 Commits
24 Forks
3 Watchers
29 Branches
19 Contributors
Updated on May 30, 2024
Latest Version
4.0.1
Package Id
ember-cli-postcss-glimmer@4.0.1
Unpacked Size
19.79 kB
Size
7.15 kB
File Count
8
NPM Version
5.6.0
Node Version
8.11.1
Cumulative downloads
Total Downloads
6
47
1ember install ember-cli-postcss
The add-on can be used in two ways:
Note: it’s possible to use both compile and filter.
This step will look for either app.css
or <project-name>.css
in your styles directory. Additional files to be processed can be defined in the output paths configuration object for your application:
1const app = new EmberApp(defaults, { 2 outputPaths: { 3 app: { 4 html: 'index.html', 5 css: { 6 'app': '/assets/app.css', 7 'print': '/assets/print.css' 8 } 9 } 10 } 11}
This step will run at the end of the build process on all CSS files, including the merged vendor.css
file and any CSS imported into the Broccoli tree by add-ons.
Files can be white-listed and/or black-listed by using the respective include and exclude options. Each accepts an array of file globs, which are then passed on to Broccoli Funnel. An example can be seen in the sample configuration below.
There are two steps to setting up postcss with ember-cli-postcss
:
postcssOptions
object in ember-cli-build.js
The postcssOptions
object should have a “compile” and/or “filter” property, which will have the properties enabled
and plugins
, which is an array of objects that contain a module
property and an options
property:
Some postcss plug-ins, like autoprefixer, allow you to configure which browsers to target for transpilation. When using Ember CLI >= 2.13.0, the browser targets configuration found in the file config/targets.js
will be added to each plug-in’s options (as options.browsers
). This browser list can be overwritten on a plug-in by plug-in basis. You can learn more about the targets feature on the Ember.js blog.
1postcssOptions: { 2 compile: { 3 enabled: true, // defaults to true 4 browsers: ['last 3 versions'], // this will override config found in config/targets.js 5 plugins: [ 6 { 7 module: <module>, 8 options: { 9 ... 10 } 11 } 12 ] 13 }, 14 filter: { 15 enabled: true, // defaults to false 16 map: false, // defaults to inline, false in production 17 browsers: ['last 3 versions'], // this will override config found in config/targets.js 18 include: ['styles/*.css'], 19 exclude: ['vendor/bootstrap/**/*'], 20 plugins: [ 21 { 22 module: <module>, 23 options: { 24 ... 25 } 26 } 27 ] 28 } 29}
Install the autoprefixer plug-in:
1npm i --save-dev autoprefixer
Specify some plug-ins in your ember-cli-build.js
:
1const EmberApp = require('ember-cli/lib/broccoli/ember-app'); 2const autoprefixer = require('autoprefixer'); 3 4module.exports = function (defaults) { 5 const app = new EmberApp(defaults, { 6 postcssOptions: { 7 compile: { 8 enabled: false, 9 browsers: ['last 3 versions'], // this will override config found in config/targets.js 10 }, 11 filter: { 12 enabled: true, 13 plugins: [ 14 { 15 module: autoprefixer, 16 options: { 17 browsers: ['last 2 versions'] // this will override the config, but just for this plugin 18 } 19 } 20 ] 21 } 22 } 23 }); 24 return app.toTree(); 25};
If you are a developing an addon and would like to use ember-cli-postcss
to process the CSS to automatically be included in the vendor.css
of Ember applications consuming the addon, there are 2 steps to follow.
addon/styles/addon.css
(you can import other CSS files if a postcss import plugin is installed)1// index.js 2const CssImport = require('postcss-import') 3const CssNext = require('postcss-cssnext') 4 5module.exports = { 6 options: { 7 postcssOptions: { 8 compile: { 9 enabled: true, 10 plugins: [ 11 { module: CssImport }, 12 { module: CssNext } 13 ] 14 } 15 } 16 } 17 ... 18}
If you’d like to migrate a project from one of the other processors, such as Less, Sass, or Stylus, you can configure Postcss with an appropriate parser and set of plugins that provides an equivalent set of features.
This then allows you to use additional Postcss plugins at the end of the compilation to continue transforming your styles for more powerful control of authoring styles in your application. This also plays nicely with ember-component-css.
So far this migration process has been tested when switching from Sass.
One common use case is to transition from using Sass to Postcss or using them both together. As of ember-cli-postcss@3.7.0
this is possible with the right combination of options and plugins.
There are three key pieces of configuration:
postcss-scss
@csstools/postcss-sass
as the first pluginYour configuration options in ember-cli-build.js
would contain the following options for this addon:
1 postcssOptions: { 2 compile: { 3 extension: 'scss', 4 enabled: true, 5 parser: require('postcss-scss'), 6 plugins: [ 7 { 8 module: require('@csstools/postcss-sass'), 9 options: { 10 includePaths: [ 11 'node_modules/tachyons-sass', 12 ], 13 }, 14 }, 15 ... 16 ], 17 }, 18 ... 19 }
This allows your to switch your CSS processing pipeline to use postcss without being hugely disruptive as you can keep the Sass features and .scss
or .sass
file extension. The importing feature of @csstools/postcss-sass
will also look for .css
files, so you can choose to gradually rename your files from Sass partials _<filename>.scss
to <filename>.css
without breaking anything.
If your goal is to completely move away from using Sass features you can remove the parser, remove the sass plugin, use an import plugin that fits your needs and ensure that your files have the .css
extension.
CSS variables are now supported by many major browsers. The values of these variables can be accessed, set, and removed using JavaScript. This addon now exports a service, which provides methods to work with CSS variables. Each method is a wrapper around the browser API, which includes a check for browser support before executing.
The service provides 3 methods:
getVal ({ element = docEl, variableName })
setVal ({ element = docEl, variableName, variableValue })
removeVal ({ element = docEl, variableName })
A Contrived Example:
1import { inject } from '@ember/service' 2 3export default <ember object>.extend({ 4 customProperties: inject(), 5 ... 6 7 nightMode() { 8 this.get('customProperties').setVal({variableName: '--background', variableValue: 'black'}) 9 this.get('customProperties').setVal({variableName: '--text', variableValue: 'white'}) 10 }, 11 12 dayMode() { 13 this.get('customProperties').setVal({variableName: '--background', variableValue: 'white'}) 14 this.get('customProperties').setVal({variableName: '--text', variableValue: 'black'}) 15 }, 16})
Note: if you are using postcss-custom-properties, ensure you configure the option { preserve: true }
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/3 approved changesets -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
56 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
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 MoreLast Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year