Gathering detailed insights and metrics for sprite-smith-loader
Gathering detailed insights and metrics for sprite-smith-loader
Gathering detailed insights and metrics for sprite-smith-loader
Gathering detailed insights and metrics for sprite-smith-loader
svg-sprite-loader
Webpack loader for creating SVG sprites
@nuxtjs/svg
Super simple svg loading module for Nuxt.js
@types/svg-sprite-loader
TypeScript definitions for svg-sprite-loader
external-svg-sprite-loader
A webpack loader and plugin that generate SVG sprites out of a collection of SVG files used in your JS and CSS files
npm install sprite-smith-loader
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
2 Stars
13 Commits
1 Watching
15 Branches
1 Contributors
Updated on 14 Apr 2022
Cumulative downloads
Total Downloads
Last day
-72.7%
3
Compared to previous day
Last week
0%
17
Compared to previous week
Last month
400%
45
Compared to previous month
Last year
-70.6%
244
Compared to previous year
1
:rocket: 中文文档点这里
Sprite Smith loader is a tool for automatically generating CSS Sprites. You can use it in webpack. It will find all the_ sprite.png End picture and auto generate CSS Sprites and modify the corresponding CSS code.
supports CSS、SASS、LESS.
The picture should be in PNG format (do not directly change the picture suffix to PNG)
To begin, you'll need to install sprite-smith-loader:
npm install --save-dev sprite-smith-loader remove-file-webpack-plugin
Then add the plugin to your webpack config. And don't forget to add the file-loader or url-loader.
For example:
webpack.config.js
// add remove-file-webpack-plugin to clean sprites folders
const RemoveFileWebpackPlugin = require('remove-file-webpack-plugin');
module.exports = {
module: {
rules: [
{
test: /\.(png|jpe?g|gif)$/i,
loader: 'file-loader',
options: {
outputPath: 'images',
},
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader','sprite-smith-loader'],
},
],
},
plugins: [
new RemoveFileWebpackPlugin({
dirNames:["sprites"]
})
],
};
with SASS
const RemoveFileWebpackPlugin = require('remove-file-webpack-plugin');
module.exports = {
module: {
rules: [
{
test: /\.(png|jpe?g|gif)$/i,
loader: 'file-loader',
options: {
outputPath: 'images',
},
},
{
test: /\.(sass|scss|css)/,
use: ['style-loader', 'css-loader','sprite-smith-loader',"sass-loader"],
}
],
},
plugins: [
new RemoveFileWebpackPlugin({
dirNames:["sprites"]
})
],
};
Change the picture name to_ sprite.png End and reference it in CSS
.my_bg_1{
height: 100px;
width: 100px;
background: url('./demo1_sprite.png') 0px 0px;
background-size: 100px 100px;
}
.my_bg_2{
height: 100px;
width: 100px;
background: url('./demo2_sprite.png') -20px -20px;
background-size: 150px 150px;
}
After the CSS Sprites is generated, the loader will modify the background attribute in the CSS. In order to accurately calculate the converted background attribute, please follow the following specifications:
Css attribute name | isRequired | Description |
---|---|---|
height | true | Unit: PX |
width | true | Unit: PX |
background-size | true | Unit: PX |
background | true | Include image,position,repeat |
background-image | true | Included in background,picture name with _ sprite.png ending |
background-position | false | Included in background,format of value PX PX |
background-repeat | false | Included in background,must be no-repeat |
If you have any questions, please create an issue on GitHub.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/13 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
43 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