Giter Club home page Giter Club logo

postcss-banner's Introduction

PostCSS Banner Dependency Status Current version NPM downloads Build Status

PostCSS plugin to add text banner and footer to resulting file.

Migration from previous versions

  • Asterisks to beginning of line are added automatically (use inline: false to disable)
  • Bang isn't added automatically (use important: true to enable)

Usage

Add PostCSS Banner to your build tool:

npm install --save-dev postcss postcss-banner

Set banner and/or footer properties to add banner and/or footer to your resulting css (so use after minifier).

Example:

postcss(require('postcss-banner')({banner: 'banner'}))

yields

/*
 * banner
 */
.foo {
}

Value will be converted to string and wrapped with spaces by default. Set inline to true to render the comment in a single line.

Example:

var postcss = require('gulp-postcss');
var postcssBanner = require('postcss-banner');

var banner = 'single line comment';

gulp.task('css', function () {
  return gulp.src('./css/src/*.css')
    .pipe(postcss(
      [
        postcssBanner({
          banner: banner,
          inline: true
        })
      ]))
    .pipe(gulp.dest('./css'));
});

yields

/* single line comment */
.foo {
}

Options

banner

Type: String

The string will be converted in a css comment and put at the beginning of the css file.

footer

Type: String

The string will be converted in a css comment and put at the end of the css file.

inline

Type: Boolean

Default: false

Render the banner all in one line.

important

Type: Boolean

Default: false

Add a bang to the comment. (eg. /*! banner v.0.0.1 */)

NOTE: Important css comments are generally preserved from being removed during a minification process.

License

MIT License Β© Eugene Datsky

See PostCSS docs for examples for your environment.

postcss-banner's People

Contributors

andreasonny83 avatar dependabot-preview[bot] avatar dependabot[bot] avatar greenkeeper[bot] avatar greenkeeperio-bot avatar kytta avatar princed avatar scrum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

postcss-banner's Issues

Depreciation warnings

Just a heads up on the latest PostCSS 5, there are these depreciation warnings coming from this plugin:

Comment#left was deprecated. Use Comment#raws.left
Comment#right was deprecated. Use Comment#raws.right
Node#before is deprecated. Use Node#raws.before

If I get chance I'll look into a PR πŸ˜„

Compatibility with PostCSS 8

Thanks for your PostCSS plugin!

As you probably know, PostCSS 8 was released a few days ago. It would be great if you could make this plugin compatible with the latest version. The creators of the project have even released this migration guide.

An in-range update of postcss is breaking the build 🚨

Version 6.0.6 of postcss just got published.

Branch Build failing 🚨
Dependency postcss
Current Version 6.0.5
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

postcss is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Release Notes 6.0.6
  • Fix end position in at-rule without semicolon (by @hzlmn).
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Doesn't work with <%= pkg.name %> tags

Hi @princed, thanks for this awesome plugin :),

My use case is very specific, I am trying to create a Wordpress Stylesheet during a Grunt build task. But my resulting file isn't parsing Grunt package tags <%= pkg.name %>. Here is my code:

banner: ' Theme Name: Theme Name\n' +
    ' Version: <%= pkg.version %> \n' +
    ' Theme URI: http://mydomain.com\n' +
    ' Author: <%= pkg.author %> \n' +
    ' Author URI: https://mydomain.com\n' +
    ' Description: <%= pkg.description %> \n' +
    ' Text domain: <%= pkg.name %> \n'
 })

and the result is:

/* Theme Name: Theme Name
Version: <%= pkg.version %>
Theme URI: http://mydomain.com
Author: <%= pkg.author %>
Author URI: https://mydomain.com
Description: <%= pkg.description %>
Text domain: <%= pkg.name %>
*/

Does this plugin not support converting those tags or am I doing something wrong?

can't run from cli

Moving from grunt to running all my build scripts as npm run commands.

The postcss-banner fails:
Error: Loading PostCSS Plugin failed: Cannot find module 'postcssBanner'

I believe there needs to be a .bin entry to run from the CLI

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.