fix(theme): Include CSS variables in the final css build

CSS Variables should be built into the distributable css file for theme support
This commit is contained in:
Faris Ansari 2018-07-19 14:28:03 +05:30
parent 312335d419
commit 1f387c9079
5 changed files with 95 additions and 529 deletions

4
.gitignore vendored
View File

@ -40,4 +40,6 @@ cypress/screenshots
cypress/videos cypress/videos
# dist # dist
dist dist
.env

View File

@ -7,7 +7,7 @@
"jsdelivr": "dist/frappe-datatable.min.js", "jsdelivr": "dist/frappe-datatable.min.js",
"scripts": { "scripts": {
"start": "yarn run dev", "start": "yarn run dev",
"build": "rollup -c && rollup -c --production", "build": "rollup -c && NODE_ENV=production rollup -c",
"dev": "rollup -c -w", "dev": "rollup -c -w",
"cy:server": "http-server -p 8989", "cy:server": "http-server -p 8989",
"cy:open": "cypress open", "cy:open": "cypress open",
@ -33,7 +33,7 @@
"eslint-plugin-import": "^2.11.0", "eslint-plugin-import": "^2.11.0",
"http-server": "^0.11.1", "http-server": "^0.11.1",
"mocha": "3.3.0", "mocha": "3.3.0",
"postcss-cssnext": "^3.1.0", "postcss-custom-properties": "^7.0.0",
"postcss-nested": "^3.0.0", "postcss-nested": "^3.0.0",
"rollup": "^0.59.4", "rollup": "^0.59.4",
"rollup-plugin-commonjs": "^8.3.0", "rollup-plugin-commonjs": "^8.3.0",

View File

@ -4,11 +4,11 @@ import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs'; import commonjs from 'rollup-plugin-commonjs';
import postcss from 'rollup-plugin-postcss'; import postcss from 'rollup-plugin-postcss';
import nested from 'postcss-nested'; import nested from 'postcss-nested';
import cssnext from 'postcss-cssnext'; import customProperties from 'postcss-custom-properties';
import eslint from 'rollup-plugin-eslint'; import eslint from 'rollup-plugin-eslint';
import merge from 'deepmerge'; import merge from 'deepmerge';
const production = process.argv[3] === '--production'; const production = process.env.NODE_ENV === '--production';
const baseJS = { const baseJS = {
input: 'src/index.js', input: 'src/index.js',
@ -40,8 +40,8 @@ const baseCSS = {
extract: true, extract: true,
minimize: production, minimize: production,
plugins: [ plugins: [
nested(), customProperties(),
cssnext() nested()
] ]
}) })
] ]
@ -85,24 +85,8 @@ const prodCSS = merge(devCSS, {
} }
}); });
// docs
const docJS = merge(devIIFE, {
output: {
file: 'docs/assets/js/frappe-datatable.js'
}
});
const docCSS = merge(devCSS, {
output: {
file: 'docs/assets/css/frappe-datatable.css'
}
});
const developmentAssets = [devIIFE, devCjs, devCSS]; const developmentAssets = [devIIFE, devCjs, devCSS];
const documentationAssets = [docJS, docCSS];
const productionAssets = [prodIIFE, prodCSS]; const productionAssets = [prodIIFE, prodCSS];
const assets = production ? productionAssets : developmentAssets;
const docs = process.argv[3] === '--docs';
const assets = docs ? documentationAssets : production ? productionAssets : developmentAssets;
export default assets; export default assets;

View File

@ -1,4 +1,4 @@
.datatable { :root {
--border-color: #d1d8dd; --border-color: #d1d8dd;
--primary-color: rgb(82, 146, 247); --primary-color: rgb(82, 146, 247);
--light-bg: #f5f7fa; --light-bg: #f5f7fa;

588
yarn.lock

File diff suppressed because it is too large Load Diff