Initial project setup
This commit is contained in:
commit
000b64f004
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.idea/
|
||||
dist/
|
||||
node_modules/
|
94
gulpfile.js
Normal file
94
gulpfile.js
Normal file
@ -0,0 +1,94 @@
|
||||
"use strict";
|
||||
|
||||
var gulp = require("gulp"),
|
||||
path = require("path"),
|
||||
gutil = require("gulp-util"),
|
||||
webpack = require("webpack");
|
||||
|
||||
|
||||
var build = function (options, callback) {
|
||||
|
||||
var plugins = [];
|
||||
|
||||
if (options.minify) {
|
||||
plugins = [
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
compress: {
|
||||
warnings: false
|
||||
},
|
||||
output: {
|
||||
comments: false,
|
||||
semicolons: true
|
||||
}
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
webpack({
|
||||
entry: path.join(__dirname, "src", "index.js"),
|
||||
bail: !options.watch,
|
||||
watch: options.watch,
|
||||
devtool: "source-map",
|
||||
plugins: plugins,
|
||||
output: {
|
||||
path: path.join(__dirname, "dist"),
|
||||
filename: "index.js"
|
||||
},
|
||||
module: {
|
||||
loaders: [{
|
||||
loader: "babel-loader",
|
||||
test: /\.js$/,
|
||||
include: [
|
||||
path.join(__dirname, "src")
|
||||
]
|
||||
}]
|
||||
}
|
||||
}, (error, stats) => {
|
||||
|
||||
if (error) {
|
||||
|
||||
var pluginError = new gutil.PluginError("webpack", error);
|
||||
|
||||
if (callback) {
|
||||
callback(pluginError);
|
||||
} else {
|
||||
gutil.log("[Webpack]", pluginError);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
gutil.log("[Webpack]", stats.toString());
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
gulp.task("build-dev", (callback) => {
|
||||
build({
|
||||
watch: false,
|
||||
minify: false
|
||||
}, callback);
|
||||
});
|
||||
|
||||
|
||||
gulp.task("build", (callback) => {
|
||||
build({
|
||||
watch: false,
|
||||
minify: true
|
||||
}, callback);
|
||||
});
|
||||
|
||||
|
||||
gulp.task("watch", () => {
|
||||
build({
|
||||
watch: true,
|
||||
minify: false
|
||||
});
|
||||
});
|
21
package.json
Normal file
21
package.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "momentumengine",
|
||||
"version": "0.0.1",
|
||||
"description": "An ES6 game and animation engine.",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Nathan Kunicki <me@nathankunicki.com>",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "^4.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "6.3.17",
|
||||
"babel-loader": "6.2.0",
|
||||
"gulp": "3.9.0",
|
||||
"gulp-util": "3.0.7",
|
||||
"webpack": "1.12.9"
|
||||
}
|
||||
}
|
1
src/index.js
Normal file
1
src/index.js
Normal file
@ -0,0 +1 @@
|
||||
console.log("Hello world!");
|
Loading…
x
Reference in New Issue
Block a user