Skip to content

Commit

Permalink
update proper deps for production mode (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip authored Sep 25, 2016
1 parent c1a5a51 commit d48190c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
},
"dependencies": {
"bluebird": "^3.4.6",
"electrode-archetype-react-app": "^1.0.0",
"electrode-confippet": "^1.0.0",
"electrode-router-resolver-engine": "^1.0.0",
"electrode-server": "^1.0.0",
"electrode-static-paths": "^1.0.0",
"lodash": "^4.10.1"
},
"devDependencies": {
"electrode-archetype-react-app": "^1.0.0",
"electrode-archetype-react-app-dev": "^1.0.0",
"gulp": "^3.9.1"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"plugins": {
"inert": {
"enable": true
},
"electrodeStaticPaths": {
"enable": true,
"options": {
"pathPrefix": "dist"
}
},
"webapp": {
"module": "./server/plugins/webapp",
"options": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,2 @@
{
"plugins": {
"inert": {
"enable": true
},
"electrodeStaticPaths": {
"enable": true,
"options": {
"pathPrefix": "dist"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//

const serveStaticFiles = () => {
return process.env.STATIC_FILES === "true";
return process.env.STATIC_FILES_OFF !== "true";
};

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@ process.on("SIGINT", () => {

const config = require("electrode-confippet").config;
const staticPathsDecor = require("electrode-static-paths");
const supports = require("electrode-archetype-react-app/supports");

/**
* css-modules-require-hook: handle css-modules on node.js server.
* similar to Babel's babel/register it compiles CSS modules in runtime.
* Use babel register to transpile any JSX code on the fly to run
* in server mode, and also transpile react code to apply process.env.NODE_ENV
* removal to improve performance in production mode.
*/
const hook = require("css-modules-require-hook");

require("babel-register")({
supports.babelRegister({
ignore: /node_modules\/(?!react\/)/
});

/**
* css-modules-require-hook: handle css-modules on node.js server.
* similar to Babel's babel/register it compiles CSS modules in runtime.
*
* generateScopedName - Short alias for the postcss-modules-scope plugin's option.
* Helps you to specify the custom way to build generic names for the class selectors.
* You may also use a string pattern similar to the webpack's css-loader.
Expand All @@ -26,7 +29,7 @@ require("babel-register")({
* https://github.com/webpack/css-loader#local-scope
* https://github.com/css-modules/postcss-modules-scope
*/
hook({
supports.cssModuleHook({
generateScopedName: "[name]__[local]___[hash:base64:5]"
});

Expand Down

0 comments on commit d48190c

Please sign in to comment.