-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat($app,$config): add initial set of css3 grid config
- Loading branch information
Jason Hodges
committed
Sep 12, 2017
1 parent
46002ff
commit 779d2ed
Showing
24 changed files
with
1,247 additions
and
181 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,34 @@ | ||
/** | ||
* @author: @JasonHodges | ||
*/ | ||
const path = require('path'); | ||
|
||
const EVENT = process.env.npm_lifecycle_event || ''; | ||
/** | ||
* Helper functions | ||
*/ | ||
const _root = path.resolve(__dirname, '..'); | ||
|
||
function root(args) { | ||
args = Array.prototype.slice.call(arguments, 0); | ||
return path.join.apply(path, [_root].concat(args)); | ||
function hasProcessFlag(flag) { | ||
return process.argv.join('').indexOf(flag) > -1; | ||
} | ||
|
||
function hasNpmFlag(flag) { | ||
return EVENT.includes(flag); | ||
} | ||
|
||
function isWebpackDevServer() { | ||
return process.argv[1] && !!(/webpack-dev-server/.exec(process.argv[1])); | ||
} | ||
|
||
var root = path.join.bind(path, _root); | ||
|
||
// function root(args) { | ||
// args = Array.prototype.slice.call(arguments, 0); | ||
// return path.join.apply(path, [_root].concat(args)); | ||
// } | ||
|
||
exports.hasProcessFlag = hasProcessFlag; | ||
exports.hasNpmFlag = hasNpmFlag; | ||
exports.isWebpackDevServer = isWebpackDevServer; | ||
exports.root = root; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
const webpack = require('webpack'); | ||
const helpers = require('./helpers'); | ||
// const marked = require('marked'); | ||
// const times = require('lodash/times'); | ||
// const sass = require('node-sass'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | ||
const WebpackShellPlugin = require('webpack-shell-plugin'); | ||
const LoopMarkdownPlugin = require('../config/LoopMarkdown'); | ||
|
||
|
||
/** | ||
* Webpack Constants | ||
*/ | ||
const HMR = helpers.hasProcessFlag('hot'); | ||
const AOT = process.env.BUILD_AOT || helpers.hasNpmFlag('aot'); | ||
const METADATA = { | ||
title: 'ngx-blog by @JasonHodges', | ||
baseUrl: '/', | ||
isDevServer: helpers.isWebpackDevServer(), | ||
HMR: HMR, | ||
AOT: AOT | ||
}; | ||
|
||
module.exports = function(options) { | ||
isProd = options.env === 'production'; | ||
return { | ||
|
||
/** | ||
* The entry point for the bundle | ||
* | ||
* See: http:https://webpack.github.io/docs/configuration.html#entry | ||
*/ | ||
entry: { | ||
'polyfills': helpers.root('src', 'polyfills.ts'), | ||
'vendor': helpers.root('src', 'vendor.ts'), | ||
'app': AOT ? helpers.root('src', 'main.aot.ts') : helpers.root('src', 'main.ts') | ||
}, | ||
|
||
/** | ||
* Options affecting the resolving of modules. | ||
* | ||
* See: http:https://webpack.github.io/docs/configuration.html#resolve | ||
*/ | ||
resolve: { | ||
|
||
/** | ||
* An array of extensions that should be used to resolve modules. | ||
* | ||
* See: http:https://webpack.github.io/docs/configuration.html#resolve-extensions | ||
*/ | ||
extensions: ['.ts', '.js', '.json'], | ||
|
||
/** | ||
* An array of directory names to be resolved to the current directory | ||
*/ | ||
modules: [helpers.root('src'), helpers.root('node_modules')], | ||
}, | ||
|
||
/** | ||
* Options affecting the normal modules. | ||
* | ||
* See: http:https://webpack.github.io/docs/configuration.html#module | ||
*/ | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
use: [ | ||
{ | ||
loader: 'babel-loader', | ||
options: { | ||
presets: ['es2015', {'modules': false}] | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
test: /\.ts$/, | ||
loaders: [{ | ||
loader: 'awesome-typescript-loader', | ||
options: { | ||
configFileName: helpers.root('src', 'tsconfig.json'), | ||
useCache: !isProd | ||
} | ||
}, | ||
'angular2-template-loader' | ||
] | ||
}, | ||
{ | ||
test: /\.html$/, | ||
loader: 'html-loader' | ||
}, | ||
{ | ||
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/, | ||
loader: 'file-loader?name=assets/[name].[hash].[ext]' | ||
}, | ||
{ | ||
test: /\.json$/, | ||
loader: 'file-loader?name=assets/[name].[hash].json' | ||
}, | ||
{ | ||
test: /\.(css|scss)$/, | ||
exclude: /node_modules/, | ||
use: [ | ||
'to-string-loader', | ||
'style-loader', | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
sourceMap: true | ||
} | ||
}, | ||
{ | ||
loader: 'sass-loader', | ||
options: { | ||
sourceMap: true | ||
} | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
// Workaround for angular/angular#11580 | ||
new webpack.ContextReplacementPlugin( | ||
// The (\\|\/) piece accounts for path separators in *nix and Windows | ||
/angular(\\|\/)core(\\|\/)@angular/, | ||
helpers.root('./src'), // location of your src | ||
{} // a map of your routes | ||
), | ||
|
||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: ['app', 'vendor', 'polyfills'] | ||
}), | ||
|
||
new HtmlWebpackPlugin({ | ||
template: helpers.root('src', 'index.html') | ||
}), | ||
|
||
new WebpackShellPlugin({ | ||
onBuildStart: ['node ./config/dir-parse.js'] | ||
}), | ||
|
||
new webpack.HotModuleReplacementPlugin(), | ||
|
||
] | ||
}; | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.