Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
postcss-prepend-plugin
Advanced tools
A PostCSS plugin to add comments to the start of CSS files with optional ASCII art. prepend copyrights, License, author information, or any other message you want to.
A simple PostCSS plugin that prepends a comment to the top of your CSS files.
This plugin allows you to prepend a comment to your CSS files containing text such as copyrights, author information, or any other message you want to display. Additionally, you can choose to add a custom ASCII Art generated from any text using the Figlet library.
keywords: CSS Prepend, PostCSS, CSS prepender, PostCSS plugin, production CSS files, CSS Copyrights, Code customization, CSS customization, CSS comments, ASCII Art, Figlet, Code formatting, CSS preprocessing, Build tools, MIT License, licensing, author information, on top of CSS File, begining of css file, Prepend Comment to CSS file, PostCSS comment prepend, Code Protection.
Check Also: PostCSS-Obfuscator | PostCSS-mobile-first
# npm
npm install postcss-prepend-plugin --save-dev
# yarn
yarn add postcss-prepend-plugin --dev
To use the plugin, first import it into your PostCSS configuration file:
//postcss.config.js
const prepend = require("postcss-prepend-plugin");
module.exports = {
plugins: [
// Add any other plugins you need here
prepend(options), //pass options
],
};
Here's some examples of how you can use postcss-prepend to add a comment to your CSS files:
For message only, you only specify the message attribute.
prepend({message: `© ${new Date().getFullYear()}|ANMOON All rights reserved.`}),
After running your CSS through postcss-prepend, the resulting file will look like this:
/* © 2023|ANMOON All rights reserved. */
body {
/* ... */
}
/* ... */
To generate an ASCII Art specify these arguments, we use figletJs Js to generate ASCII Art. so check all variants there.
prepend({
message: `© ${new Date().getFullYear()}. All rights reserved.`,
spacesBefore: 13,
name: 'ANMOON',
artOptions: {
font: "Modular",
width: 60,
horizontalLayout: "fitted",
verticalLayout: "fitted",
whitespaceBreak: false,
},
}),
Once you've processed your CSS using postcss-prepend, your resulting file will have a comment added to the top after the ASCII Art, like this:]
/*
_______ __ _ __ __ _______ _______ __ _
| _ || | | || |_| || || || | | |
| |_| || |_| || || _ || _ || |_| |
| || || || | | || | | || |
| || _ || || |_| || |_| || _ |
| _ || | | || ||_|| || || || | | |
|__| |__||_| |__||_| |_||_______||_______||_| |__|
© 2023. All rights reserved.
*/
body {
/* ... */
}
/* ... */
"postcss": "postcss src/**/*.css --dir build",
"postcss:watch": "postcss src/**/*.css --dir build --watch"
Contributions are welcome! If you find a bug or have a feature request, please open an issue on the GitHub repository.
Tests included:
npm test
This project is licensed under the MIT License. See the LICENSE file for more information.
FAQs
A PostCSS plugin to add comments to the start of CSS files with optional ASCII art. prepend copyrights, License, author information, or any other message you want to.
The npm package postcss-prepend-plugin receives a total of 10 weekly downloads. As such, postcss-prepend-plugin popularity was classified as not popular.
We found that postcss-prepend-plugin 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 initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.