1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-15 21:06:44 +02:00
TableFilter/Gruntfile.js

143 lines
4.8 KiB
JavaScript
Raw Normal View History

module.exports = function (grunt) {
var webpack = require("webpack");
// var webpackConfig = require("./webpack.config.js");
var path = require("path");
2015-04-28 09:50:53 +02:00
grunt.initConfig({
2015-05-10 13:12:31 +02:00
jshint: {
src: [
'Gruntfile.js',
'src-es6/**/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
qunit: {
files: ['test/**/*.html']
},
"webpack-dev-server": {
options: {
webpack: webpack.dev,
publicPath: "/src/"
},
start: {
keepAlive: true,
webpack: {
devtool: "eval",
debug: true
}
}
},
webpack: {
2015-05-10 13:12:31 +02:00
// "dev": {
// entry: __dirname + '/src-es6/tablefilter.js',
// // entry: {
// // tablefilter: __dirname + '/src-es6/tablefilter.js',
// // colsVisibility: __dirname +
// // '/src-es6/extensions/colsVisibility/colsVisibility.js'
// // },
// output: {
// publicPath: "/src/",
// path: __dirname + "/src",
// filename: "tablefilter.js",
// chunkFilename: "[name].js",
// libraryTarget: 'umd'
// },
// resolve: {
// extensions: ['', '.js']
// },
// module: {
// loaders: [{
// test: path.join(__dirname, 'src-es6'),
// exclude: /node_modules/,
// query: {
// compact: false
// },
// loader: 'babel-loader'
// }]
// },
// devtool: "sourcemap",
// debug: true
// },
"build": {
entry: __dirname + '/src-es6/tablefilter.js',
// entry: {
// tablefilter: __dirname + '/src-es6/tablefilter.js',
// sortabletable: __dirname + '/libs/sortabletable.js'
// },
output: {
publicPath: "/dist/",
path: __dirname + "/dist",
filename: "tablefilter.js",
2015-05-03 13:11:06 +02:00
// chunkFilename: "[name]-[chunkhash].js",
chunkFilename: "[name].js",
libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js'],
alias: {
2015-05-10 13:12:31 +02:00
sortabletable: "../../../libs/sortabletable.js"
// ,
// adapterSortabletable:
// './extensions/sortabletable/adapterSortabletable'
}
},
// externals: {
// 'sortabletable': "SortableTable"
// },
module: {
loaders: [{
test: path.join(__dirname, 'src-es6'),
exclude: /node_modules/,
query: {
compact: false
},
loader: 'babel-loader'
2015-05-03 13:11:06 +02:00
}]
},
plugins: [
// new webpack.DefinePlugin({
// "process.env": {
// // This has effect on the react lib size
// "NODE_ENV": JSON.stringify("production")
// }
// }),
2015-05-03 13:11:06 +02:00
// new webpack.IgnorePlugin(/adapterSortabletable$/),
2015-05-10 13:12:31 +02:00
new webpack.optimize.DedupePlugin(),
new webpack.optimize.MinChunkSizePlugin(
{minChunkSize: 10000})
// ,
// new webpack.optimize.UglifyJsPlugin()
]
}
}
});
2015-05-10 13:12:31 +02:00
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-webpack');
// The development server (the recommended option for development)
grunt.registerTask("default", ["webpack-dev-server:start"]);
// Build and watch cycle (another option for development)
// Advantage: No server required, can run app from filesystem
// Disadvantage: Requests are not blocked until bundle is available,
// can serve an old app on too fast refresh
grunt.registerTask("dev", ["webpack:dev"/*, "watch:app"*/]);
// Production build
2015-05-10 13:12:31 +02:00
grunt.registerTask("build", ['jshint', "webpack:build"]);
// Tests
grunt.registerTask('test', ['qunit']);
2015-02-15 09:55:23 +01:00
};