Setup styles build

pull/1/head
Nikita Karamov 2020-03-25 18:53:00 +01:00
parent b00532af4c
commit 8574dc0d51
No known key found for this signature in database
GPG Key ID: E40DFE6E993540FF
7 changed files with 1964 additions and 48 deletions

View File

@ -30,12 +30,15 @@
"@rollup/plugin-strip": "^1.3.2", "@rollup/plugin-strip": "^1.3.2",
"@rollup/plugin-typescript": "^4.0.0", "@rollup/plugin-typescript": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^2.24.0", "@typescript-eslint/eslint-plugin": "^2.24.0",
"cssnano": "^4.1.10",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-config-airbnb-typescript": "^7.2.0", "eslint-config-airbnb-typescript": "^7.2.0",
"eslint-plugin-import": "^2.20.1", "eslint-plugin-import": "^2.20.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",
"rollup": "^2.2.0", "rollup": "^1.32.1",
"rollup-plugin-postcss": "^2.5.0",
"rollup-plugin-terser": "^5.3.0", "rollup-plugin-terser": "^5.3.0",
"typescript": "^3.8.3" "typescript": "^3.8.3"
} }

View File

@ -1,7 +1,18 @@
import postcssPluginCssnano from 'cssnano';
import rollupPluginPostcss from 'rollup-plugin-postcss';
import rollupPluginStrip from '@rollup/plugin-strip'; 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';
export const postcss = (file, minify) => rollupPluginPostcss({
extract: file || true,
plugins: [
minify && postcssPluginCssnano({
preset: 'default',
})
],
})
export const strip = () => rollupPluginStrip({ export const strip = () => rollupPluginStrip({
debugger: true, debugger: true,
functions: ['console.log', 'console.debug'], functions: ['console.log', 'console.debug'],

View File

@ -1,4 +1,4 @@
import { typescript } from './plugins'; import { postcss, typescript } from './plugins';
const input = './src/index.ts'; const input = './src/index.ts';
const name = 'shareon'; const name = 'shareon';
@ -14,5 +14,6 @@ export default {
}, },
plugins: [ plugins: [
typescript(), typescript(),
postcss(`${outputDir}${name}.css`, false),
], ],
}; };

View File

@ -1,4 +1,4 @@
import { strip, terser, typescript } from './plugins'; import { postcss, strip, terser, typescript } from './plugins';
const input = './src/index.ts'; const input = './src/index.ts';
const name = 'shareon'; const name = 'shareon';
@ -27,6 +27,7 @@ export default {
], ],
plugins: [ plugins: [
typescript(), typescript(),
postcss(`${outputDir}${name}.css`, true),
strip(), strip(),
], ],
}; };

View File

@ -0,0 +1 @@
import './style.scss';

0
src/style.scss Normal file
View File

1989
yarn.lock

File diff suppressed because it is too large Load Diff