2
0
mirror of https://github.com/frappe/books.git synced 2024-11-14 01:14:03 +00:00

Rollup config generator

This commit is contained in:
Faris Ansari 2018-05-08 11:29:46 +05:30
parent 695f02eb49
commit bf59d21af7
3 changed files with 46 additions and 34 deletions

View File

@ -1,18 +0,0 @@
module.exports = {
input: './www/index.js',
output: {
file: './www/dist/js/bundle.js',
format: 'iife',
name: 'desk',
sourcemap: true,
globals: ['io', 'nunjucks'], // for socketio client, which is imported directly,
},
plugins: [
require('rollup-plugin-commonjs')(),
require('rollup-plugin-json')(),
require('rollup-plugin-html')(),
require('rollup-plugin-node-resolve')({
preferBuiltins: true
}),
],
}

View File

@ -1,16 +0,0 @@
module.exports = {
input: './node_modules/frappejs/client/style/style.scss',
output: {
file: './www/dist/css/style.css',
format: 'cjs'
},
plugins: [
require('rollup-plugin-postcss')({
extract: true,
plugins: [
require('precss'),
require('autoprefixer')
]
})
]
};

46
config/rollup.js Normal file
View File

@ -0,0 +1,46 @@
const commonjs = require('rollup-plugin-commonjs');
const json = require('rollup-plugin-json');
const html = require('rollup-plugin-html');
const nodeResolve = require('rollup-plugin-node-resolve');
const precss = require('precss');
const autoprefixer = require('autoprefixer');
const postcss = require('rollup-plugin-postcss');
const getJSConfig = ({input, output}) => ({
input: input,
output: {
file: output,
format: 'iife',
name: 'desk',
sourcemap: true,
globals: ['io', 'nunjucks'], // for socketio client, which is imported directly,
},
plugins: [
commonjs(),
json(),
html(),
nodeResolve(),
],
});
const getCSSConfig = ({input, output}) => ({
input: input,
output: {
file: output,
format: 'cjs'
},
plugins: [
postcss({
extract: true,
plugins: [
precss,
autoprefixer
]
})
]
});
module.exports = {
getJSConfig,
getCSSConfig
}