
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@thenja/concat-scss
Advanced tools
Concatenate scss / css files into one file
npm install @thenja/concat-scss --save-dev
const ConcatScss = require('@thenja/concat-scss');
const concatScss = new ConcatScss();
const options = {
src: './scss/index.scss',
dest: './dist/scss/index.scss'
};
concatScss.concat(options)
.then((result) => {
// the file contents output is also returned
console.log(result.output);
}).catch((err) => {
throw err;
});
Option | Required | Description |
---|---|---|
src | required | The filepath to the source file |
dest | required | The filepath to the output destination file |
rootDir | optional | The root directory of the project, basically where the node_modules folder is found. By default, concat-scss will use process.cwd() to find the root directory, if by any chance this is wrong, you can manully pass it in |
removeImports | optional | Remove / Ignore any imports you do not want in the output file (example below) |
outputCss | optional | Default value: false. Use node-sass to compile the scss into css |
copyAssetsToDest | optional | Default value: false. By default, all asset urls are base64 encoded inline in the scss files, however, if you want, you can copy the assets to the output directory (Refer to the detailed example below). |
addAutoGeneratedComment | optional | Add a comment at the top of the file that states the code was auto generated and should not be modified |
@import "_variables";
@import "~bootstrap/scss/bootstrap.scss";
$testVar: #000;
.test {
color: $testVar;
}
const ConcatScss = require('@thenja/concat-scss');
const concatScss = new ConcatScss();
const options = {
src: './scss/index.scss',
dest: './dist/scss/index.scss',
removeImports: [ '~bootstrap/scss/bootstrap.scss' ]
};
concatScss.concat(options)
.then((result) => {
// the file contents output is also returned
console.log(result.output);
}).catch((err) => {
throw err;
});
The copyAssetsToDest option can either be a boolean value or an array of asset urls that you want to copy to the destination directory. If set to true, all assets will be copied to the destination directory.
In the example below, we will only copy the font asset icomoon.svg to the output destination directory, where as the fake-logo.png asset will still be base64 encoded inline.
$color-primary: #000;
.logo {
color: $color-primary;
background-image: url("./fake-logo.png");
}
@font-face {
font-family: 'icomoon';
src:
url('icomoon/fonts/icomoon.svg') format('svg');
font-weight: normal;
font-style: normal;
}
const ConcatScss = require('@thenja/concat-scss');
const concatScss = new ConcatScss();
const options = {
src: './scss/index.scss',
dest: './dist/scss/index.scss',
copyAssetsToDest: [ 'icomoon/fonts/icomoon.svg' ],
// copyAssetsToDest: true (all assets will be copied if set to true)
};
concatScss.concat(options)
.then((result) => {
// the file contents output is also returned
console.log(result.output);
}).catch((err) => {
throw err;
});
In your scss code, add the following comments, anything in between these comments will be excluded from the output
// concat-scss-ignore-start
$variableThatWillBeExcluded: #ccc;
// concat-scss-ignore-end
npm run init
- Setup the app for development (run once after cloning)
npm run dev
- Run this command when you want to work on this app. It will
compile typescript, run tests and watch for file changes.
npm run build -- -v <version>
- Create a distribution build of the app.
-v (version) - [Optional] Either "patch", "minor" or "major". Increase the version number in the package.json file.
The build command creates a /compiled directory which has all the javascript compiled code and typescript definitions. As well, a /dist directory is created that contains a minified javascript file.
Tests are automatically ran when you do a build.
npm run test
- Run the tests. The tests will be ran in a nodejs environment.
You can run the tests in a browser environment by opening the file
/spec/in-browser/SpecRunner.html.
MIT © Nathan Anderson
FAQs
Concat scss or css files into one file
We found that @thenja/concat-scss 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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.