Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ember-cli-css-preprocess
Advanced tools
Preprocess your stylesheets with multiple preprocessors like node-sass, postcss or less
Preprocess your stylesheets with multiple preprocessors.
Currently supported preprocessors:
Please feel free to fork in order to add more processors!
You can determine in which order the stylesheets are processed!
ember install ember-cli-css-preprocess
All the configuration for this plugin is stored in the ember-cli-build.js
in the root-directory of your ember application.
Search for the following lines:
var app = new EmberApp(defaults, {
// Add options here
...
And add the the basic options:
var app = new EmberApp(defaults, {
// Add options here
styleProcessorOptions: {
processors: [],
extension: 'css'
}
...
Currently there a two available preprocessors which you can chain in any order (even multiple times if you want).
Available processors:
To add on simply pass in an object to the processors
-Array containing a type
-Property with the processor title.
var app = new EmberApp(defaults, {
// Add options here
styleProcessorOptions: {
processors: [{
type: 'sass'
}],
extension: 'scss'
}
...
By changing the extension
-property you can specify the extension of your stylesheets. Because we are only processing our sheets with Sass we set the extension to scss
.
Annotation: You can also pass all setting you could pass to node-sass by setting the options
-object in the processor object. By default the only setting is the includePath
which is set to your styles
-folder. This allows you to include any stylesheet in your folder with the @import
-rule
var app = new EmberApp(defaults, {
// Add options here
styleProcessorOptions: {
processors: [{
type: 'postcss',
plugins: [{
module: require('autoprefixer'),
options: {
browsers: [
'last 2 versions'
]
}
]
}],
extension: 'css'
}
...
This is a basic postcss implementation using the autoprefixer plugin.
The plugin
-array is filled with objects with the module
and the options
properties. The latter obviously contains the options which are passed into the module/plugin when processing your stylesheets.
Annotation: Before requiring any postcss-plugin you have to install it via npm (e.g. npm install autoprefixer --save
).
You can also add a custom parser or syntax by adding it to the processor object. Here is an example which uses the postcss-scss parser
(for adding a syntax, use the syntax
property):
var app = new EmberApp(defaults, {
// Add options here
styleProcessorOptions: {
processors: [{
type: 'postcss',
parser: require('postcss-scss'),
//syntax: require('postcss-scss'),
plugins: [{
module: require('autoprefixer'),
options: {
browsers: [
'last 2 versions'
]
}
]
}],
extension: 'css'
}
...
var app = new EmberApp(defaults, {
// Add options here
styleProcessorOptions: {
processors: [{
type: 'less'
}],
extension: 'css'
}
...
To include any less plugin you can make use of the plugins
-array, it is handled like the postcss-plugin array.
var app = new EmberApp(defaults, {
// Add options here
styleProcessorOptions: {
processors: [{
type: 'postcss',
plugins: [{
module: require('autoprefixer'),
options: {
browsers: [
'last 2 versions'
]
}
]
}, {
type: 'sass'
}
],
extension: 'css'
}
...
This example should clarify how to chain preprocessors. The position inside the processors
-array determines the order in which the stylesheets are processed by each preprocessors (from top to bottom).
var app = new EmberApp(defaults, {
// Add options here
styleProcessorOptions: {
processors: [{
type: 'postcss',
file: ['test.css'],
plugins: [{
module: require('autoprefixer'),
options: {
browsers: [
'last 2 versions'
]
}
]
}, {
type: 'sass'
}
],
extension: 'css'
}
...
With this setup the postcss processor will only process the file test.css
. The file
property can either be a string or an array of strings.
FAQs
Preprocess your stylesheets with multiple preprocessors like node-sass, postcss or less
The npm package ember-cli-css-preprocess receives a total of 125 weekly downloads. As such, ember-cli-css-preprocess popularity was classified as not popular.
We found that ember-cli-css-preprocess demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.