Gathering detailed insights and metrics for sprite-magic-importer
Gathering detailed insights and metrics for sprite-magic-importer
Gathering detailed insights and metrics for sprite-magic-importer
Gathering detailed insights and metrics for sprite-magic-importer
node-sass-magic-importer
Custom node-sass importer for selector specific imports, node importing, module importing, globbing support and importing files only once
node-sass-glob-importer
Custom importer for node-sass which makes it possible to use glob syntax in Sass import statements
node-sass-package-importer
Custom importer for node-sass to import packages from the `node_modules` directory
@humanwhocodes/module-importer
Universal module importer for Node.js
npm install sprite-magic-importer
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
3 Stars
132 Commits
1 Forks
3 Watching
14 Branches
2 Contributors
Updated on 20 Jul 2020
JavaScript (78.8%)
CSS (20.51%)
HTML (0.7%)
Cumulative downloads
Total Downloads
Last day
114.3%
15
Compared to previous day
Last week
86.2%
54
Compared to previous week
Last month
-0.5%
1,672
Compared to previous month
Last year
770.8%
12,592
Compared to previous year
Custom node-sass importer for create CSS Sprites like Magic Imports of the Compass.
Input
1@import "icons/*.png"; 2@include all-icons-sprites(true); 3 4.foo { 5 .bar { 6 @include icons-sprite(chrome); 7 } 8}
Output
1.icons-sprite, .icons-chrome, .icons-firefox, .icons-ie, .foo .bar { 2 background-image: url("/images/icons.png?_=bfa627d"); 3 background-repeat: no-repeat; 4} 5 6.icons-chrome { 7 background-position: -32px 0; 8 width: 32px; 9 height: 32px; 10} 11 12...snip... 13 14.foo .bar { 15 background-position: -32px 0; 16} 17 18.foo .bar:hover, .foo .bar.chrome-hover { 19 background-position: 0 0; 20} 21
See: Example
@mixin all-<map>-sprites()
@mixin <map>-sprite()
@mixin <map>-sprite-dimensions()
@function <map>-sprite-width()
@function <map>-sprite-height()
Supported are hover, target, active, and focus.
$disable-magic-sprite-selectors
false
$sprite-selectors
hover, target, active, focus
$default-sprite-separator
-
$<map>-sprite-base-class
.<map>-sprite
$<map>-sprite-dimensions
false
$<map>-class-separator
$default-sprite-separator
Create configure script.
importer.js
1var SpriteMagicImporter = require('sprite-magic-importer');
2
3module.exports = SpriteMagicImporter({
4 // http://compass-style.org/help/documentation/configuration-reference/
5 sass_dir: 'src/sass',
6 images_dir: 'src/images',
7 generated_images_dir: 'dist/images',
8 http_stylesheets_path: '/css',
9 http_generated_images_path: '/images',
10
11 // spritesmith options
12 spritesmith: {
13 algorithm: `diagonal`,
14 padding: 2
15 },
16
17 // imagemin-pngquant options
18 pngquant: {
19 quality: 75,
20 speed: 10
21 }
22});
build.js
Plese note: You cannot use sass.renderSync
with this importer.
1var sass = require('node-sass'); 2var importer = require('./importer'); 3 4sass.render({ 5 ... 6 importer: importer 7 ... 8});
string
- The path to the root of the project.
process.cwd()
string
- The path to the project when running within the web server.
/
string
- The directory where the sass stylesheets are kept. It is relative to the project_path.
sass
string
- The directory where the css stylesheets are kept. It is relative to the project_path.
stylesheets
string
- The directory where the images are kept. It is relative to the project_path.
images
string
- The directory where generated images are kept. It is relative to the project_path.
string
- The full http path to generated images on the web server.
/
+ generated_images_dirstring
- The full http path to stylesheets on the web server.
/
+ css_dirboolean
- Set this to true to speed up using the cache.
string
- The full path to where cache of temporary stylesheets are kept.
/sprite-magic-importer
regexp
- Regular expression for detecting high resolution image from file name.
/@(\d)x$/
object
- This option is passed to the Spritesmith.run()
.
object
- This option is passed to the imagemin-pngquant
.
1node-sass --importer ./importer.js -o dist/css src/app.scss
1@import "icons/*.png"; // '*@2x.png' will not be imported 2@include all-icons-sprites(true); 3 4@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) { 5 @import "icons/*@2x.png"; 6 @include all-icons-sprites(); 7}
The MIT License (MIT)
Copyright (c) 2016 Takayuki Irokawa
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/18 approved changesets -- score normalized to 0
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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
41 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
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