npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

postcss-prepend-plugin

v1.0.7

Published

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.

Downloads

25

Readme

:copyright: postcss-prepend

  • :date:19-22-2023 :pushpin:Version 1.0.6
  • :computer:NajibRachid :purple_circle:ANMOON :office: XHUB

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


Installation

# npm
npm install postcss-prepend-plugin --save-dev
# yarn
yarn add postcss-prepend-plugin --dev

Usage

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
  ],
};

Examples

Here's some examples of how you can use postcss-prepend to add a comment to your CSS files:

Comment only

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 {
  /* ... */
}
/* ... */

Comment with ASCII Art

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 {
  /* ... */
}
/* ... */

npm scripts example

    "postcss": "postcss src/**/*.css  --dir build",
    "postcss:watch": "postcss src/**/*.css --dir build --watch"

Contributing

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

License

This project is licensed under the MIT License. See the LICENSE file for more information.