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
npm install sprite-magic-importer
Typescript
Module System
Node Version
NPM Version
55.9
Supply Chain
86.5
Quality
67.4
Maintenance
50
Vulnerability
95.3
License
JavaScript (78.8%)
CSS (20.51%)
HTML (0.7%)
Total Downloads
61,461
Last Day
6
Last Week
50
Last Month
311
Last Year
12,607
3 Stars
132 Commits
1 Forks
3 Watching
14 Branches
2 Contributors
Minified
Minified + Gzipped
Latest Version
1.6.2
Package Id
sprite-magic-importer@1.6.2
Unpacked Size
42.36 kB
Size
9.65 kB
File Count
8
NPM Version
6.1.0
Node Version
10.5.0
Cumulative downloads
Total Downloads
Last day
-25%
6
Compared to previous day
Last week
-36.7%
50
Compared to previous week
Last month
107.3%
311
Compared to previous month
Last year
598.1%
12,607
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
project is not fuzzed
Details
Reason
security policy file not detected
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
42 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
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