From e6b98492e790c844000dc46b8992ff53d0590a6d Mon Sep 17 00:00:00 2001 From: Sangbum Kim Date: Sat, 2 Apr 2016 03:47:54 +0900 Subject: [PATCH] added source files --- .bootstraprc | 116 +++++++++++++++++ index.dev.html | 108 ++++++++++++++++ index.prod.html | 110 ++++++++++++++++ package.json | 48 +++++++ server.js | 56 +++++++++ src/main/coffee/main.coffee | 2 + src/main/scss/bootstrap/customizations.scss | 12 ++ .../scss/bootstrap/pre-customizations.scss | 26 ++++ webpack.config.coffee | 115 +++++++++++++++++ webpack.prod.config.coffee | 118 ++++++++++++++++++ 10 files changed, 711 insertions(+) create mode 100644 .bootstraprc create mode 100644 index.dev.html create mode 100644 index.prod.html create mode 100644 package.json create mode 100644 server.js create mode 100644 src/main/coffee/main.coffee create mode 100644 src/main/scss/bootstrap/customizations.scss create mode 100644 src/main/scss/bootstrap/pre-customizations.scss create mode 100644 webpack.config.coffee create mode 100644 webpack.prod.config.coffee diff --git a/.bootstraprc b/.bootstraprc new file mode 100644 index 0000000..0dc8c78 --- /dev/null +++ b/.bootstraprc @@ -0,0 +1,116 @@ +--- +# Output debugging info +# loglevel: debug + +# Major version of Bootstrap: 3 or 4 +bootstrapVersion: 3 + +# If Bootstrap version 3 is used - turn on/off custom icon font path +useCustomIconFontPath: false + +# Webpack loaders, order matters +styleLoaders: + - style + - css?sourceMap + - resolve-url?sourceMap + - sass?sourceMap +# Extract styles to stand-alone css file +# Different settings for different environments can be used, +# It depends on value of NODE_ENV environment variable +# This param can also be set in webpack config: +# entry: 'bootstrap-loader/extractStyles' +extractStyles: false +# env: +# development: +# extractStyles: false +# production: +# extractStyles: true + + +# Customize Bootstrap variables that get imported before the original Bootstrap variables. +# Thus, derived Bootstrap variables can depend on values from here. +# See the Bootstrap _variables.scss file for examples of derived Bootstrap variables. +# +preBootstrapCustomizations: ./src/main/scss/bootstrap/pre-customizations.scss + + +# This gets loaded after bootstrap/variables is loaded +# Thus, you may customize Bootstrap variables +# based on the values established in the Bootstrap _variables.scss file +# +bootstrapCustomizations: ./src/main/scss/bootstrap/customizations.scss + + +# Import your custom styles here +# Usually this endpoint-file contains list of @imports of your application styles +# +#appStyles: ./path/to/your/app/styles/endpoint.scss + + +### Bootstrap styles +styles: + + # Mixins + mixins: true + + # Reset and dependencies + normalize: true + print: true + glyphicons: true + + # Core CSS + scaffolding: true + type: true + code: true + grid: true + tables: true + forms: true + buttons: true + + # Components + component-animations: true + dropdowns: true + button-groups: true + input-groups: true + navs: true + navbar: true + breadcrumbs: true + pagination: true + pager: true + labels: true + badges: true + jumbotron: true + thumbnails: true + alerts: true + progress-bars: true + media: true + list-group: true + panels: true + wells: true + responsive-embed: true + close: true + + # Components w/ JavaScript + modals: true + tooltip: true + popovers: true + carousel: true + + # Utility classes + utilities: true + responsive-utilities: true + +### Bootstrap scripts +scripts: + transition: true + alert: true + button: true + carousel: true + collapse: true + dropdown: true + modal: true + tooltip: true + popover: true + scrollspy: true + tab: true + affix: true diff --git a/index.dev.html b/index.dev.html new file mode 100644 index 0000000..5e563f3 --- /dev/null +++ b/index.dev.html @@ -0,0 +1,108 @@ + + + + + + + + + + + + Starter Template for Bootstrap + + + + + +
+
+

h1. Bootstrap heading Secondary text

+

h2. Bootstrap heading Secondary text

+

h3. Bootstrap heading Secondary text

+

h4. Bootstrap heading Secondary text

+
h5. Bootstrap heading Secondary text
+
h6. Bootstrap heading Secondary text
+
+
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
+
+
.col-md-8
+
.col-md-4
+
+
+
.col-md-4
+
.col-md-4
+
.col-md-4
+
+
+
.col-md-6
+
.col-md-6
+
+
+ + diff --git a/index.prod.html b/index.prod.html new file mode 100644 index 0000000..56f7f10 --- /dev/null +++ b/index.prod.html @@ -0,0 +1,110 @@ + + + + + + + + + + + + Starter Template for Bootstrap + + + + + + + +
+
+

h1. Bootstrap heading Secondary text

+

h2. Bootstrap heading Secondary text

+

h3. Bootstrap heading Secondary text

+

h4. Bootstrap heading Secondary text

+
h5. Bootstrap heading Secondary text
+
h6. Bootstrap heading Secondary text
+
+
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
.col-md-1
+
+
+
.col-md-8
+
.col-md-4
+
+
+
.col-md-4
+
.col-md-4
+
.col-md-4
+
+
+
.col-md-6
+
.col-md-6
+
+
+ + diff --git a/package.json b/package.json new file mode 100644 index 0000000..1677de1 --- /dev/null +++ b/package.json @@ -0,0 +1,48 @@ +{ + "private": true, + "dependencies": { + "bootstrap-sass": "^3.3.6", + "consolelog": "^2.1.3", + "es5-shim": "^4.5.7", + "es6-shim": "^0.35.0", + "font-awesome": "^4.5.0", + "html5shiv": "^3.7.3", + "jquery": "^2.2.2", + "jquery.backstretch": "^2.1.13", + "json3": "^3.3.2", + "lodash": "^4.7.0", + "nprogress": "^0.2.0", + "tether": "^1.2.0" + }, + "devDependencies": { + "autoprefixer": "^6.3.5", + "body-parser": "^1.15.0", + "bootstrap-loader": "^1.0.10", + "coffee-loader": "^0.7.2", + "coffee-script": "^1.10.0", + "css-loader": "^0.23.1", + "eslint": "^2.5.3", + "eslint-loader": "^1.3.0", + "express": "^4.13.4", + "extract-text-webpack-plugin": "^1.0.1", + "file-loader": "^0.8.5", + "font-awesome-loader": "0.0.1", + "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-loader": "^0.8.2", + "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" + } +} diff --git a/server.js b/server.js new file mode 100644 index 0000000..3842c67 --- /dev/null +++ b/server.js @@ -0,0 +1,56 @@ +'use strict'; + + +require("coffee-script/register") + +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}`); +}); diff --git a/src/main/coffee/main.coffee b/src/main/coffee/main.coffee new file mode 100644 index 0000000..19cbbe9 --- /dev/null +++ b/src/main/coffee/main.coffee @@ -0,0 +1,2 @@ +logger=require('consolelog') +logger("hello World") diff --git a/src/main/scss/bootstrap/customizations.scss b/src/main/scss/bootstrap/customizations.scss new file mode 100644 index 0000000..3b3a261 --- /dev/null +++ b/src/main/scss/bootstrap/customizations.scss @@ -0,0 +1,12 @@ + +// Customize variables + +// This gets loaded after bootstrap/variables is loaded, so you can refer to +// bootstrap variables configured by bootstrap. For example, the _variables.scss contains: +// $btn-primary-bg: $brand-primary !default; + +// Here we're adjusting the hue of that default: +$btn-primary-bg: adjust-hue($btn-primary-bg, +20deg); + +// NOTE: $gray-dark is defined in _variables.scss +$body-bg: #ffffff; \ No newline at end of file diff --git a/src/main/scss/bootstrap/pre-customizations.scss b/src/main/scss/bootstrap/pre-customizations.scss new file mode 100644 index 0000000..81a241d --- /dev/null +++ b/src/main/scss/bootstrap/pre-customizations.scss @@ -0,0 +1,26 @@ +// Customize Bootstrap variables that get imported before the original Bootstrap variables. +// Thus original Bootstrap variables can depend on values from here. +// +//$font-family-sans-serif: 'OpenSans-Light', Tahoma, "Helvetica Neue", Helvetica, Arial, sans-serif; +// +//// This path is relative to this file! +//$fonts-url-path: '../fonts'; +// +//@font-face { +// font-family: 'OpenSans-Light'; +// src: url('#{$fonts-url-path}/OpenSans-Light.ttf') format('truetype'); +//} + +// Other font size variables are based on this on, so this absolutely should go into the +// pre-customizations.scss file. +// $font-size-base: 16px; + +// Here is what is in the _variables.scss file of Bootstrap 3 +// $font-size-base: 14px !default; +// $font-size-large: ceil(($font-size-base * 1.25)) !default; // ~18px +// $font-size-small: ceil(($font-size-base * 0.85)) !default; // ~12px + +// If you're using a custom icon font path, specify it as follows +// $icon-font-path: ../fonts // This path is relative to this file +// $icon-font-name: 'glyphicons' // The name of the font you want to use +// And be sure to set useCustomIconFontPath to true in .bootstraprc. diff --git a/webpack.config.coffee b/webpack.config.coffee new file mode 100644 index 0000000..f98d14b --- /dev/null +++ b/webpack.config.coffee @@ -0,0 +1,115 @@ +'use strict' +path = require('path') +webpack = require('webpack') +autoprefixer = require('autoprefixer') + +module.exports = + debug: true + resolve: + root: __dirname + modulesDirectories: [ 'node_modules' ] + extensions: [ + '' + '.coffee' + '.js' + ] + alias: 'underscore': 'lodash' + entry: + main: [ + 'webpack-hot-middleware/client' + 'tether' + 'font-awesome-loader' + 'bootstrap-loader' + './src/main/coffee/main' + ] + vendor: [ + 'consolelog' + '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: '#cheap-module-eval-source-map' + plugins: [ + 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: /\.coffee$/ + loader: 'eslint' + exclude: /node_modules/ + ] + loaders: [ + test: /\.coffee$/ + loader: 'coffee-loader' + , + 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' + , + test:/bootstrap-sass[\/\\]assets[\/\\]javascripts[\/\\]/ + loader: 'imports?jQuery=jquery' + ] + 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' diff --git a/webpack.prod.config.coffee b/webpack.prod.config.coffee new file mode 100644 index 0000000..4d891ac --- /dev/null +++ b/webpack.prod.config.coffee @@ -0,0 +1,118 @@ +'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: [ + '' + '.coffee' + '.js' + ] + alias: + 'underscore': 'lodash' + entry: + main: [ + 'tether' + 'font-awesome-loader' + 'bootstrap-loader/extractStyles' + './src/main/coffee/main' + ] + vendor: [ + 'consolelog' + '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 (extractTextPlugin)('[name].css', { allChunks: true }) + new (webpack.NoErrorsPlugin) + new (webpack.ProvidePlugin)( + 'window.Tether': 'tether' + ) +# new (webpack.optimize.CommonsChunkPlugin)( +# name: 'vendor', +# chunks: ['vendor'], +# filename: 'vendor.js', +# minChunks: Infinity, +# async: true +# ) + new (webpack.optimize.DedupePlugin), + new (webpack.optimize.OccurrenceOrderPlugin)(true) + new (webpack.optimize.UglifyJsPlugin)( + mangle: true + output: + comments: false + compress: + warnings: false + ) + ] + module: + preLoaders: [ + test: /\.coffee$/ + loader: 'eslint' + exclude: /node_modules/ + ] + loaders: [ + test: /\.coffee$/ + loader: 'coffee-loader' + , + test: /\.scss$/ + loader: extractTextPlugin.extract('style', 'css!postcss!sass') + , + test: /\.css$/ + exclude: /.*\.min.css/ + loader: extractTextPlugin.extract('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' + , + test: /bootstrap-sass[\/\\]assets[\/\\]javascripts[\/\\]/ + loader: 'imports?jQuery=jquery' + ] + 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'