Last active
September 15, 2016 09:21
-
-
Save tomchentw/368a93bb748ad9d576f1 to your computer and use it in GitHub Desktop.
React.js + Bootstrap.scss + Webpack configuration files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: node_js | |
node_js: | |
- '0.10' | |
install: npm run dev_install | |
env: | |
global: | |
secure: CODECLIMATE_TOKEN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"__template__gist": "https://gist.github.com/tomchentw/368a93bb748ad9d576f1#file-bower-json", | |
"name": "PLACEHOLDER__NAME", | |
"main": "lib/index.js", | |
"version": "0.1.0", | |
"homepage": "https://github.com/tomchentw/PLACEHOLDER__NAME", | |
"author": { | |
"name": "tomchentw", | |
"email": "[email protected]", | |
"url": "https://github.com/tomchentw" | |
}, | |
"description": "PLACEHOLDER__DESCRIPTION", | |
"license": "MIT", | |
"private": true, | |
"ignore": [ | |
"**/.*", | |
"node_modules", | |
"bower_components", | |
"test", | |
"tests", | |
"webpack.config.js" | |
], | |
"devDependencies": { | |
"bootstrap-sass-official": "~3.2.0", | |
"github-fork-ribbon-css": "~0.1.1", | |
"prism": "3e9491d33bb2e8b959f0cd97ebad927285885158", | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
/** | |
* __template__gist__: https://gist.github.com/tomchentw/368a93bb748ad9d576f1#file-webpack-config-js | |
*/ | |
var Path = require("path"), | |
webpack = require("webpack"), | |
HtmlWebpackPlugin = require("html-webpack-plugin"), | |
webpackConfig, | |
IS_PRODUCTION = "production" === process.env.NODE_ENV, | |
JSX_WITH_HOT_LOEADERS = ["react-hot-loader", "jsx-loader?harmony"], | |
CSS_LOADER = "style-loader!css-loader?root=../", | |
SCSS_LOADER = CSS_LOADER + "!sass-loader?" + JSON.stringify({ | |
includePaths: [ | |
Path.resolve(__dirname, "../bower_components/bootstrap-sass-official/assets/stylesheets"), | |
] | |
}); | |
webpackConfig = module.exports = { | |
entry: "./client/scripts/index.js", | |
output: { | |
path: Path.resolve(__dirname, "../public/assets"), | |
publicPath: "assets/", | |
filename: (IS_PRODUCTION ? "[hash].js" : "bundle.js") | |
}, | |
resolve: { | |
root: [ | |
Path.join(__dirname, "../bower_components") | |
] | |
}, | |
module: { | |
loaders: [ | |
{ test: require.resolve("react/addons"), loader: "expose-loader?React" }, | |
{ test: /\.js(x?)$/, loaders: JSX_WITH_HOT_LOEADERS }, | |
{ test: /\.jpg$/, loader: "file-loader" }, | |
{ test: /\.css$/, loader: CSS_LOADER }, | |
{ test: /\.scss$/, loader: SCSS_LOADER }, | |
] | |
}, | |
plugins: [ | |
new webpack.ResolverPlugin( | |
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"]) | |
), | |
new webpack.ProvidePlugin({ | |
$: "jquery", | |
jQuery: "jquery", | |
}), | |
new HtmlWebpackPlugin({ | |
template: "./client/index.html", | |
filename: "../index.html" | |
}) | |
] | |
}; | |
if (IS_PRODUCTION) { | |
webpackConfig.plugins.push( | |
new webpack.optimize.DedupePlugin() | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"__template__gist__": "https://gist.github.com/tomchentw/368a93bb748ad9d576f1#file-package-json", | |
"name": "PLACEHOLDER__NAME", | |
"version": "1.0.0", | |
"description": "PLACEHOLDER__DESCRIPTION", | |
"main": "lib/index.js", | |
"scripts": { | |
"build": "jsx --harmony ./src ./lib", | |
"build_client": "webpack -p --config ./client/webpack.config.js", | |
"test": "jest", | |
"dev_install": "npm install && npm dedupe && bower install", | |
"dev": "webpack --config ./client/webpack.config.js && webpack-dev-server --config ./client/webpack.config.js --inline --hot --content-base ./public" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "https://github.com/tomchentw/PLACEHOLDER__NAME" | |
}, | |
"keywords": [ | |
"React.js", | |
"React", | |
"react-component" | |
], | |
"author": { | |
"name": "tomchentw", | |
"email": "[email protected]", | |
"url": "https://github.com/tomchentw" | |
}, | |
"license": { | |
"type": "MIT", | |
"url": "http://tomchentw.mit-license.org" | |
}, | |
"bugs": { | |
"url": "https://github.com/tomchentw/PLACEHOLDER__NAME/issues" | |
}, | |
"homepage": "https://github.com/tomchentw/PLACEHOLDER__NAME", | |
"devDependencies": { | |
"bower": "^1.3.9", | |
"css-loader": "^0.9.0", | |
"expose-loader": "^0.5.3", | |
"file-loader": "^0.8.1", | |
"html-webpack-plugin": "^1.1.0", | |
"jest-cli": "^0.1.18", | |
"jquery": "^2.1.1", | |
"jsx-loader": "^0.12.1", | |
"raw-loader": "^0.5.1", | |
"react-hot-loader": "^0.5.0", | |
"react-tools": "^0.12.0", | |
"sass-loader": "^0.3.0", | |
"style-loader": "^0.8.1", | |
"tomchentw-npm-dev": "^1.1.0", | |
"webpack": "^1.4.7", | |
"webpack-dev-server": "^1.6.5" | |
}, | |
"dependencies": { | |
"react": "^0.12.0" | |
}, | |
"jest": { | |
"scriptPreprocessor": "<rootDir>/test/__preprocessor__.js", | |
"testPathDirs": [ | |
"<rootDir>/src" | |
], | |
"testPathIgnorePatterns": [ | |
"/node_modules/", | |
"<rootDir>/node_modules/" | |
], | |
"unmockedModulePathPatterns": [ | |
"<rootDir>/node_modules/react" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment