Add banner to CSS output

pull/4/head
Nikita Karamov 2020-03-30 00:20:12 +02:00
parent db310d96a8
commit 13e1812824
No known key found for this signature in database
GPG Key ID: E40DFE6E993540FF
3 changed files with 20 additions and 1 deletions

View File

@ -50,6 +50,7 @@
"node-sass": "^4.13.1", "node-sass": "^4.13.1",
"np": "^6.2.0", "np": "^6.2.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"postcss-banner": "^3.0.1",
"rollup": "^1.32.1", "rollup": "^1.32.1",
"rollup-plugin-license": "^0.13.0", "rollup-plugin-license": "^0.13.0",
"rollup-plugin-postcss": "^2.5.0", "rollup-plugin-postcss": "^2.5.0",

View File

@ -1,3 +1,6 @@
import path from 'path';
import postcssPluginBanner from 'postcss-banner';
import postcssPluginCssnano from 'cssnano'; import postcssPluginCssnano from 'cssnano';
import rollupPluginLicense from 'rollup-plugin-license'; import rollupPluginLicense from 'rollup-plugin-license';
import rollupPluginPostcss from 'rollup-plugin-postcss'; import rollupPluginPostcss from 'rollup-plugin-postcss';
@ -5,10 +8,14 @@ import rollupPluginStrip from '@rollup/plugin-strip';
import { terser as rollupPluginTerser } from 'rollup-plugin-terser'; import { terser as rollupPluginTerser } from 'rollup-plugin-terser';
import rollupPluginTypescript from '@rollup/plugin-typescript'; import rollupPluginTypescript from '@rollup/plugin-typescript';
const pkg = require(path.join(process.cwd(), 'package.json'));
const bannerText = `${pkg.name} v${pkg.version} by Nikita Karamov
${pkg.homepage}`;
export const license = () => rollupPluginLicense({ export const license = () => rollupPluginLicense({
banner: { banner: {
commentStyle: 'ignored', commentStyle: 'ignored',
content: '<%= pkg.name %> v<%= pkg.version %> by Nikita Karamov\nhttps://shareon.js.org' content: bannerText
} }
}); });
@ -21,6 +28,10 @@ export const postcss = (file = true, minify) => rollupPluginPostcss({
plugins: [ plugins: [
minify && postcssPluginCssnano({ minify && postcssPluginCssnano({
preset: 'default', preset: 'default',
}),
postcssPluginBanner({
banner: bannerText,
important: true
}) })
], ],
}); });

View File

@ -5196,6 +5196,13 @@ posix-character-classes@^0.1.0:
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=
postcss-banner@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/postcss-banner/-/postcss-banner-3.0.1.tgz#130ec592cefd3f5b52bc54f7f01c8881603c22fc"
integrity sha512-uHZoJ5VmnqHAMGHJU8KJHrkLuynp72N9PPn1T4f0iVBDoApsOkr1OmY4Mk0t2e5lNfrDgOUNEBHj8RbYa8zvbw==
dependencies:
postcss "^7.0.14"
postcss-calc@^7.0.1: postcss-calc@^7.0.1:
version "7.0.2" version "7.0.2"
resolved "https://registry.yarnpkg.com/postcss-calc/-/postcss-calc-7.0.2.tgz#504efcd008ca0273120568b0792b16cdcde8aac1" resolved "https://registry.yarnpkg.com/postcss-calc/-/postcss-calc-7.0.2.tgz#504efcd008ca0273120568b0792b16cdcde8aac1"