Gathering detailed insights and metrics for postcss-assets-rebase
Gathering detailed insights and metrics for postcss-assets-rebase
Gathering detailed insights and metrics for postcss-assets-rebase
Gathering detailed insights and metrics for postcss-assets-rebase
npm install postcss-assets-rebase
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Node Version
NPM Version
21 Stars
65 Commits
5 Forks
15 Watching
1 Branches
21 Contributors
Updated on 15 Nov 2022
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-45.9%
230
Compared to previous day
Last week
-13.2%
1,718
Compared to previous week
Last month
748.6%
7,035
Compared to previous month
Last year
56.9%
16,123
Compared to previous year
5
4
PostCSS plugin to rebase assets used in project
Copies all assets used in .css
to specified folder and rebases all paths.
Features:
If you have any questions of think that some additional options are needed – feel free to create an issue.
1$ npm install postcss-assets-rebase
Plugin throws warnings when asset can't be found or duplicate is renamed.
Warnings are thrown using postcss.messages
. To output warnings in console you can use postcss-reporter.
1// dependencies 2var fs = require("fs") 3var postcss = require("postcss") 4var rebaser = require("postcss-assets-rebase") 5var reporter = require('postcss-reporter'); 6 7// css to be processed 8var css = fs.readFileSync("input.css", "utf8") 9 10// process css 11postcss() 12 .use(rebaser({ 13 assetsPath: "assets/imported", // new path for all assets 14 relative: true // is assetsPath relative to .css position. 15 //By default its relative to process.cwd() 16 })) 17 .use(reporter) 18 .process(css, { 19 from: "src/stylesheet/index.css" 20 to: "dist/index.css" 21 }) 22 .then(function (result) { 23 var output = result.css; 24 });
src/stylesheet/index.css
:1body { 2 background: url("../../assets/img.jpg"); 3 background: url(another-assets/another-img.jpg); 4 background: url("../../assets/not-existing-image.jpg"); 5 background: url("http://goo.gl/VR2dL6"); 6}
1body { 2 background: url(assets/imported/img.jpg); 3 background: url(assets/imported/another-img.jpg); 4 background: url(../../assets/not-existing-image.jpg); 5 background: url(http://goo.gl/VR2dL6); 6}
|-- dist
|-- index.css
|-- assets
|-- imported
|-- another-img.jpg
|-- img.jpg
Checkout tests for more usage examples.
assetsPath
(required)Type: String
Path to place assets to
relative
(optional)Type: Boolean
Default: False
Is assetsPath relative to .css position. By default its relative to process.cwd()
keepStructure
(optional)Type: Boolean
Default: False
To keep folder structure or not. By default all assets paths are collected flatly in assetsPath
folder.
If you set this flag to true
, folder structure relative to process.cwd() would be saved.
So then example above would generate following files:
|-- dist
|-- index.css
|-- assets
|-- imported
|-- assets
|-- img.jpg
|-- src
|-- stylesheet
|-- another-assets
|-- another-img.jpg
renameDuplicates
(optional)Type: Boolean
Default: False
If there are assets with different paths but same name, they would be renamed using name_%
pattern.
By default only first asset would be copied.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 10/29 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- 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
Score
Last Scanned on 2024-11-25
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