Skip to content

allonsy-studio/postcss-licensing

postcss-licensing

Prepends licensing or other metadata to CSS files.

Tests NPM version

Installation

yarn add -D postcss-licensing
postcss -u postcss-licensing -o dist/index.css src/index.css

Usage

This plugin will prepend your CSS file with a copyright/license. If no path or filename is provided, the plugin will try to find a file with the name LICENSE or COPYRIGHT at the cwd of the postcss config.

You can expect to turn a file like this:

.spectrum--express {
  --spectrum-actionbutton-border-color: transparent;
  --spectrum-actionbutton-background-color: purple;
}

into this:

/*!
 * <copyright content>
 */

.spectrum--express {
  --spectrum-actionbutton-background-color: purple;
  --spectrum-actionbutton-border-color: transparent;
}

Options

  • filename [type: string[] or string]: optional filename or set of possible filenames. A single filename or full path is allowed. The first item found in the array will be used so be sure to provide them in priority order. Defaults to: ["COPYRIGHT", "LICENSE"].
  • cwd [type: string]: optional working directory from which to search for license files. Defaults to: process.cwd().
  • skipIfEmpty [type: boolean]: if true, skips adding the license when the rest of the file is empty. Defaults to: true.

Example

postcss([
  require('postcss-licensing')({
    filename: 'LICENSE.txt',
    cwd: path.join(process.cwd(), '../../'),
    skipIfEmpty: false,
  })
]).process(...)

Contributing

Contributions are welcome and appreciated! Please open an issue (before submitting a pull request) if you find a bug, have a feature request, or have a question. Be sure to follow the contribution guidelines and code of conduct but most importantly, be excellent to each other. 💖

License

This project is licensed under the MPL-2.0 License - see the LICENSE file for details. This means you can use this freely, modify as needed; changes to MPL-licensed files should be shared back under the same license.

Funding ☕️

If you find this plugin useful and would like to buy me a coffee/beer as a small thank you, I would greatly appreciate it!

Buy Me A Coffee

About

Prepends licensing or other metadata to CSS files.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

2 watching

Forks

Sponsor this project

  •  

Packages

 
 
 

Contributors