1
0
Fork 0

added template file

This commit is contained in:
Sangbum Kim 2016-04-03 02:53:21 +09:00
parent 3303462570
commit 6f4c654481
10 changed files with 484 additions and 0 deletions

20
index.dev.html Normal file
View File

@ -0,0 +1,20 @@
<!doctype html>
<html lang="en" data-framework="backdonejs">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Starter Template for Bootstrap</title>
<script type="text/javascript" src="assets/vendor.js" charset="utf-8"></script>
<script type="text/javascript" src="assets/main.js" charset="utf-8"></script>
</head>
<body>
<div id="app">APPLICATION CONTENT</div>
<script>__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__</script>
</body>
</html>

20
index.prod.html Normal file
View File

@ -0,0 +1,20 @@
<!doctype html>
<html lang="en" data-framework="backdonejs">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Starter Template for Bootstrap</title>
<link rel="stylesheet" type="text/css" href="assets/vendor.css">
<script type="text/javascript" src="assets/vendor.js" charset="utf-8"></script>
<script type="text/javascript" src="assets/main.js" charset="utf-8"></script>
</head>
<body>
<div id="app">APPLICATION CONTENT</div>
</body>
</html>

60
package.json Normal file
View File

@ -0,0 +1,60 @@
{
"private": true,
"dependencies": {
"consolelog": "^2.1.3",
"es5-shim": "^4.5.7",
"es6-shim": "^0.35.0",
"html5shiv": "^3.7.3",
"jquery": "^2.2.2",
"jquery.backstretch": "^2.1.13",
"json3": "^3.3.2",
"lodash": "^4.7.0",
"material-ui": "^0.15.0-alpha.2",
"normalize.css": "^4.0.0",
"react": "^0.14.8",
"react-dom": "^0.14.0",
"react-tap-event-plugin": "^0.2.2"
},
"devDependencies": {
"autoprefixer": "^6.3.5",
"babel-core": "^6.7.4",
"babel-eslint": "^6.0.0",
"babel-loader": "^6.2.4",
"babel-plugin-transform-runtime": "^6.6.0",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.0.15",
"babel-preset-react": "^6.0.15",
"body-parser": "^1.15.0",
"bower-webpack-plugin": "^0.1.9",
"cjsx-loader": "^2.1.0",
"coffee-loader": "^0.7.2",
"coffee-script": "^1.10.0",
"css-loader": "^0.23.1",
"eslint": "^2.2.0",
"eslint-loader": "^1.0.0",
"eslint-plugin-react": "^4.0.0",
"express": "^4.13.4",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.8.5",
"html-loader": "^0.4.3",
"imports-loader": "^0.6.5",
"json-loader": "^0.5.4",
"markdown-loader": "^0.1.7",
"node-sass": "^3.4.2",
"postcss": "^5.0.11",
"postcss-loader": "^0.8.2",
"react-addons-test-utils": "^0.14.0",
"react-hot-loader": "^1.3.0",
"resolve-url-loader": "^1.4.3",
"sass-loader": "^3.2.0",
"style-loader": "^0.13.1",
"text-loader": "0.0.1",
"url-loader": "^0.5.7",
"webpack": "^1.12.14",
"webpack-dev-middleware": "^1.6.1",
"webpack-hot-middleware": "^2.10.0"
},
"scripts": {
"start": "node server.js"
}
}

58
server.js Normal file
View File

@ -0,0 +1,58 @@
'use strict';
require("coffee-script/register");
require('core-js/fn/object/assign');
var express = require('express');
var url = require('url');
var webpack = require('webpack');
var webpackDevMiddleware = require('webpack-dev-middleware');
var webpackHotMiddleware = require('webpack-hot-middleware');
var bodyParser = require('body-parser');
var config = require('./webpack.config');
var host = '127.0.0.1';
var port = 8080;
var server = express();
var compiler = webpack(config);
server.use(webpackDevMiddleware(compiler, {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true,
stats: {
colors: true,
hash: false,
version: false,
chunks: false,
children: false,
},
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'X-Requested-With'
},
}));
server.use(webpackHotMiddleware(compiler));
server.use(bodyParser.json());
server.use(bodyParser.urlencoded({ extended: true }));
server.get('/', function(req, res) {
res.sendFile(config.resolve.root + '/index.dev.html');
});
server.listen(port, 'localhost', err => {
if (err) console.log(`=> OMG!!! 🙀 ${err}`);
console.log(`=> 🔥 Webpack dev server is running on port ${port}`);
});

View File

@ -0,0 +1,25 @@
React=require 'react'
mui=require('material-ui')
rawTheme=require('source/cjsx/components/Theme')
AppBar=mui.AppBar
RaisedButton=mui.RaisedButton
class App extends React.Component
constructor: (props, context)->
super(props, context)
@childContextTypes :
muiTheme: React.PropTypes.object
getChildContext: ->
muiTheme: mui.Styles.getMuiTheme(rawTheme)
render: ->
<div>
<AppBar title="My AppBar" />
<RaisedButton label="My Button" primary={true} />
</div>
module.exports=App

View File

@ -0,0 +1,23 @@
mui=require('material-ui')
Colors=require('material-ui/lib/styles/colors')
ColorManipulator=mui.Utils.ColorManipulator
Spacing=require('material-ui/lib/styles/spacing')
zIndex=require('material-ui/lib/styles/zIndex')
module.exports=
spacing: Spacing
zIndex: zIndex
fontFamily: 'Roboto, sans-serif'
palette:
primary1Color: Colors.red500
primary2Color: Colors.cyan700
primary3Color: Colors.lightBlack
accent1Color: Colors.pinkA200
accent2Color: Colors.grey100
accent3Color: Colors.grey500
textColor: Colors.darkBlack
alternateTextColor: Colors.white
canvasColor: Colors.white
borderColor: Colors.grey300
disabledColor: ColorManipulator.fade(Colors.darkBlack, 0.3)
pickerHeaderColor: Colors.cyan500

12
src/main/cjsx/main.cjsx Normal file
View File

@ -0,0 +1,12 @@
require('core-js/fn/object/assign')
React=require('react')
ReactDom=require('react-dom')
App = require('source/cjsx/components/App')
window.React = React
window.ReactDom = ReactDom
document.addEventListener("DOMContentLoaded",
(event)->
ReactDom.render(<App />, document.getElementById 'app')
)

0
src/main/scss/main.scss Normal file
View File

135
webpack.config.coffee Normal file
View File

@ -0,0 +1,135 @@
'use strict'
path = require('path')
webpack = require('webpack')
autoprefixer = require('autoprefixer')
module.exports =
debug: true
resolve:
root: __dirname
modulesDirectories: [ 'node_modules' ]
extensions: [
''
'.cjsx'
'.coffee'
'.jsx'
'.js'
]
alias:
underscore: 'lodash'
source: path.join(__dirname, '/src/main')
entry:
main: [
'webpack-hot-middleware/client'
'source/cjsx/main'
],
vendor: [
'normalize.css/normalize.css'
'es5-shim'
'es5-shim/es5-sham'
'es6-shim'
'es6-shim/es6-sham'
'json3'
'html5shiv'
'html5shiv/dist/html5shiv-printshiv'
]
output:
path: path.join(__dirname, './assets')
filename: '[name].js'
publicPath: '/assets/'
pathinfo: true
devtool: 'eval'
plugins: [
new (webpack.PrefetchPlugin)("react")
new (webpack.PrefetchPlugin)("react/lib/ReactComponentBrowserEnvironment")
new (webpack.HotModuleReplacementPlugin)
new (webpack.NoErrorsPlugin)
new (webpack.ProvidePlugin)(
'window.Tether': 'tether'
)
# new (webpack.optimize.CommonsChunkPlugin)(
# name: 'vendor',
# chunks: ['vensor'],
# filename: 'vendor.js',
# minChunks: Infinity
# )
]
module:
preLoaders: [
test: /\.(js|jsx)$/
loader: 'eslint'
exclude: /node_modules/
]
loaders: [
test: /\.(js|jsx)?$/
exclude: /(node_modules|bower_components)/
loader: [
'react-hot'
'babel'
]#'babel-loader' is also a legal name to reference
query:
presets: ['es2015']
plugins: ['transform-runtime']
,
test: /\.cjsx$/
loaders: [
'react-hot'
'coffee'
'cjsx'
]#'babel-loader' is also a legal name to reference
,
test: /\.coffee$/
loaders: [
'react-hot'
'coffee'
]#'babel-loader' is also a legal name to reference
,
test: /\.scss$/
loaders: [
'style'
'css'
'postcss'
'sass'
]
,
test: /\.css$/
exclude: /.*\.min.css/
loaders: [
'style'
'css'
'postcss'
]
,
test: /\.png$/
loader: 'url?limit=8192&mimetype=image/png'
,
test: /\.jpe?g$/
loader: 'url?limit=8192&mimetype=image/jpg'
,
test: /\.gif$/
loader: 'url?limit=8192&mimetype=image/gif'
,
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/
loader: 'url?limit=8192&mimetype=image/svg+xml'
,
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/
loader: 'url?limit=8192&mimetype=application/font-woff2'
,
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/
loader: 'url?limit=8192&mimetype=application/font-woff'
,
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/
loader: 'url?limit=8192&mimetype=application/octet-stream'
,
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/
loader: 'file'
]
postcss: [ autoprefixer ]
eslint:
emitErrors: true
reporter: (results) ->
results.map((result) ->
result.messages.map((msg) ->
' ' + msg.message + '(' + msg.ruleId + ')' + ' @ line ' + msg.line + ' column ' + msg.column + ' - ' + (if msg.fatal then 'fatal, ' else '') + 'severity: ' + msg.severity
).join '\n'
).join '\n'

131
webpack.prod.config.coffee Normal file
View File

@ -0,0 +1,131 @@
'use strict'
path = require('path')
webpack = require('webpack')
autoprefixer = require('autoprefixer')
extractTextPlugin = require('extract-text-webpack-plugin')
module.exports =
debug: false
resolve:
root: __dirname
modulesDirectories: ['node_modules']
extensions: [
''
'.cjsx'
'.coffee'
'.jsx'
'.js'
]
alias:
underscore: 'lodash'
source: path.join(__dirname, '/src/main')
entry:
main: [
'source/cjsx/main'
]
vendor: [
'normalize.css/normalize.css'
'es5-shim'
'es5-shim/es5-sham'
'es6-shim'
'es6-shim/es6-sham'
'json3'
'html5shiv'
'html5shiv/dist/html5shiv-printshiv'
]
output:
path: path.join(__dirname, './assets')
filename: '[name].js'
# filename: "[name]-[chunkhash].js"
# chunkFilename: "[name]-[chunkhash].js"
publicPath: '/assets/'
pathinfo: false
plugins: [
new (webpack.PrefetchPlugin)("react")
new (webpack.PrefetchPlugin)("react/lib/ReactComponentBrowserEnvironment")
new (extractTextPlugin)('[name].css', { allChunks: true })
new (webpack.NoErrorsPlugin)
new (webpack.optimize.DedupePlugin),
new (webpack.optimize.OccurrenceOrderPlugin)(true)
new (webpack.optimize.UglifyJsPlugin)(
sourceMap: true
mangle:
except: [
'$super'
'$'
'_'
'exports'
'require'
]
minimize: true
output:
comments: false
compress:
warnings: false
)
]
module:
preLoaders: [
test: /\.(js|jsx)$/
loader: 'eslint'
exclude: /node_modules/
]
loaders: [
test: /\.(js|jsx)?$/
exclude: /(node_modules|bower_components)/
loader: [
'babel'
]#'babel-loader' is also a legal name to reference
query:
presets: ['es2015']
plugins: ['transform-runtime']
,
test: /\.cjsx$/
loaders: [
'coffee'
'cjsx'
]#'babel-loader' is also a legal name to reference
,
test: /\.coffee$/
loader: 'coffee'
,
test: /\.scss$/
loader: extractTextPlugin.extract('style', 'css?minimize!postcss!sass')
,
test: /\.css$/
exclude: /.*\.min.css/
loader: extractTextPlugin.extract('style', 'css?minimize!postcss')
,
test: /\.png$/
loader: 'url?limit=8192&mimetype=image/png'
,
test: /\.jpe?g$/
loader: 'url?limit=8192&mimetype=image/jpg'
,
test: /\.gif$/
loader: 'url?limit=8192&mimetype=image/gif'
,
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/
loader: 'url?limit=8192&mimetype=image/svg+xml'
,
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/
loader: 'url?limit=8192&mimetype=application/font-woff2'
,
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/
loader: 'url?limit=8192&mimetype=application/font-woff'
,
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/
loader: 'url?limit=8192&mimetype=application/octet-stream'
,
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/
loader: 'file'
]
postcss: [ autoprefixer ]
eslint:
emitErrors: true
reporter: (results) ->
results.map((result) ->
result.messages.map((msg) ->
' ' + msg.message + '(' + msg.ruleId + ')' + ' @ line ' + msg.line + ' column ' + msg.column + ' - ' + (if msg.fatal then 'fatal, ' else '') + 'severity: ' + msg.severity
).join '\n'
).join '\n'