Skip to content

Commit

Permalink
Fix whawker#20 Provide scripts [build:css|build:css:prod]
Browse files Browse the repository at this point in the history
 With react-jsx-highcharts you can now choose to build using
 highcharts/js/highcharts to use CSS to style your charts
  • Loading branch information
Axel Duch committed Sep 4, 2017
1 parent 3484f44 commit 1eb0fdb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/react-jsx-highcharts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
],
"scripts": {
"build": "cross-env NODE_ENV=development ./node_modules/.bin/webpack",
"build:css": "cross-env NODE_ENV=development MODE=CSS ./node_modules/.bin/webpack",
"build:prod": "cp ../../README.md . && cross-env NODE_ENV=production ./node_modules/.bin/webpack -p",
"build:css:prod": "cp ../../README.md . && cross-env MODE=CSS NODE_ENV=production ./node_modules/.bin/webpack -p",
"lint": "./node_modules/.bin/eslint src",
"test": "cross-env NODE_ENV=test ./node_modules/.bin/mocha --compilers js:babel-core/register --require test/test-helper.js test/**/*.spec.js"
},
Expand Down Expand Up @@ -44,6 +46,7 @@
"babel-eslint": "^7.2.3",
"babel-loader": "^7.0.0",
"babel-plugin-lodash": "^3.2.11",
"babel-plugin-module-resolver": "^2.7.1",
"babel-plugin-transform-react-remove-prop-types": "^0.4.5",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.0",
Expand Down
15 changes: 15 additions & 0 deletions packages/react-jsx-highcharts/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,23 @@ const fs = require('fs');
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');

const isProd = (process.env.NODE_ENV === 'production');
const styledMode = (process.env.MODE === 'CSS');

const babelSettings = JSON.parse(fs.readFileSync('.babelrc'));


if (babelSettings.plugins && styledMode) {
console.log('Using highchars/js/highcharts.js instead of highcharts.js - styled mode');
babelSettings.plugins.push([
"module-resolver", {
"root": ["."],
"alias": {
"highcharts": "./node_modules/highcharts/js/highcharts"
}
}]
);
}

const webpackConfig = {
entry: path.resolve(__dirname, 'src'),

Expand Down

0 comments on commit 1eb0fdb

Please sign in to comment.