mirror of
https://github.com/wassname/template.git
synced 2026-06-27 17:50:45 +08:00
Minify on build, but not during development
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@
|
||||
"url": "https://github.com/distillpub/distill-template/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "rollup -c rollup.config.js -w",
|
||||
"start": "rollup -c rollup.config.dev.js -w",
|
||||
"serve": "python3 -m http.server --bind 127.0.0.1",
|
||||
"test": "mocha",
|
||||
"lint": "eslint",
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import string from 'rollup-plugin-string';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
|
||||
const componentsConfig = {
|
||||
entry: 'src/components.js',
|
||||
targets: [{format: 'umd', moduleName: 'dl', dest: 'dist/template.v2.js'}],
|
||||
};
|
||||
|
||||
const transformsConfig = {
|
||||
entry: 'src/transforms.js',
|
||||
targets: [{format: 'umd', moduleName: 'dl', dest: 'dist/transforms.js'}],
|
||||
};
|
||||
|
||||
const defaultConfig = {
|
||||
sourceMap: true,
|
||||
plugins: [
|
||||
resolve({
|
||||
jsnext: true,
|
||||
browser: true,
|
||||
}),
|
||||
string({
|
||||
include: ['**/*.txt', '**/*.svg', '**/*.html', '**/*.css', '**/*.base64']
|
||||
}),
|
||||
commonjs(),
|
||||
]
|
||||
};
|
||||
|
||||
Object.assign(componentsConfig, defaultConfig);
|
||||
Object.assign(transformsConfig, defaultConfig);
|
||||
|
||||
export default [
|
||||
componentsConfig,
|
||||
transformsConfig,
|
||||
];
|
||||
+5
-38
@@ -1,45 +1,12 @@
|
||||
import copy from 'rollup-plugin-copy';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import string from 'rollup-plugin-string';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
// import babili from 'rollup-plugin-babili';
|
||||
import configs from './rollup.config.dev';
|
||||
import babili from 'rollup-plugin-babili';
|
||||
|
||||
const componentsConfig = {
|
||||
entry: 'src/components.js',
|
||||
targets: [{format: 'umd', moduleName: 'dl', dest: 'dist/components.js'}],
|
||||
};
|
||||
const [componentsConfig, transformsConfig] = configs;
|
||||
|
||||
const transformsConfig = {
|
||||
entry: 'src/transforms.js',
|
||||
targets: [{format: 'umd', moduleName: 'dl', dest: 'dist/transforms.js'}],
|
||||
};
|
||||
|
||||
const defaultConfig = {
|
||||
componentsConfig.plugins.push(babili({
|
||||
comments: false, // means: *remove* comments
|
||||
sourceMap: true,
|
||||
plugins: [
|
||||
resolve({
|
||||
jsnext: true,
|
||||
browser: true,
|
||||
}),
|
||||
string({
|
||||
include: ['**/*.txt', '**/*.svg', '**/*.html', '**/*.css', '**/*.base64']
|
||||
}),
|
||||
commonjs(),
|
||||
// babili({
|
||||
// comments: false, // means: *remove* comments
|
||||
// sourceMap: true,
|
||||
// })
|
||||
]
|
||||
};
|
||||
|
||||
Object.assign(componentsConfig, defaultConfig);
|
||||
componentsConfig.plugins.push(copy({
|
||||
'./node_modules/katex/dist/fonts': 'dist/fonts',
|
||||
'./node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js': 'dist/webcomponents-lite.js',
|
||||
'./node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js.map': 'dist/webcomponents-lite.js.map',
|
||||
'./node_modules/intersection-observer/intersection-observer.js': 'dist/intersection-observer.js',
|
||||
}));
|
||||
Object.assign(transformsConfig, defaultConfig);
|
||||
|
||||
export default [
|
||||
componentsConfig,
|
||||
|
||||
Reference in New Issue
Block a user