Merge branch 'webpack' into 'master'
Webpack pooooowwwwwaaaaaa See merge request !20
This commit is contained in:
commit
64d731a9c6
@ -1,65 +0,0 @@
|
||||
import gulp from 'gulp';
|
||||
import babel from 'gulp-babel';
|
||||
import less from 'gulp-less';
|
||||
import del from 'del';
|
||||
import webpack from 'webpack-stream';
|
||||
import webpackConfig from './webpack.config.babel';
|
||||
|
||||
const paths = {
|
||||
allSrcJs: 'src/**/*.js?(x)',
|
||||
jsSrc: 'src/public/js/app.js',
|
||||
jsDistDir: 'build/public/js',
|
||||
lessSrc: 'src/public/less/app.less',
|
||||
lessDest: 'build/public/css',
|
||||
fontSrc: [
|
||||
'./node_modules/font-awesome/fonts/*',
|
||||
'./node_modules/bootstrap/fonts/*',
|
||||
],
|
||||
fontDest: 'build/public/fonts',
|
||||
imgSrc: 'src/public/img/*',
|
||||
imgDest: 'build/public/img/',
|
||||
htmlSrc: 'src/public/index.html',
|
||||
htmlDest: 'build/public/',
|
||||
gulpFile: 'gulpfile.babel.js',
|
||||
webpackFile: 'webpack.config.babel.js',
|
||||
};
|
||||
|
||||
gulp.task('less', () =>
|
||||
gulp.src(paths.lessSrc)
|
||||
.pipe(less({
|
||||
paths: [ './node_modules' ]
|
||||
}))
|
||||
.pipe(gulp.dest(paths.lessDest))
|
||||
);
|
||||
|
||||
gulp.task('fonts', () =>
|
||||
gulp.src(paths.fontSrc)
|
||||
.pipe(gulp.dest(paths.fontDest))
|
||||
);
|
||||
|
||||
gulp.task('images', () =>
|
||||
gulp.src(paths.imgSrc)
|
||||
.pipe(gulp.dest(paths.imgDest))
|
||||
);
|
||||
|
||||
gulp.task('html', () =>
|
||||
gulp.src(paths.htmlSrc)
|
||||
.pipe(gulp.dest(paths.htmlDest))
|
||||
);
|
||||
|
||||
gulp.task('js', () =>
|
||||
gulp.src(paths.jsSrc)
|
||||
.pipe(webpack(webpackConfig))
|
||||
.pipe(gulp.dest(paths.jsDistDir))
|
||||
);
|
||||
|
||||
gulp.task('main', ['less', 'fonts', 'images', 'html', 'js'])
|
||||
|
||||
gulp.task('watch', () => {
|
||||
gulp.watch(paths.allSrcJs, ['js']);
|
||||
gulp.watch(paths.lessSrc, ['less']);
|
||||
gulp.watch(paths.imgSrc, ['images']);
|
||||
gulp.watch(paths.htmlSrc, ['html']);
|
||||
});
|
||||
|
||||
gulp.task('default', ['watch', 'main']);
|
17
package.json
17
package.json
@ -1,13 +1,7 @@
|
||||
{
|
||||
"name": "canape",
|
||||
"scripts": {
|
||||
"start": "gulp"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
"react",
|
||||
"latest"
|
||||
]
|
||||
"start": "./node_modules/webpack/bin/webpack.js -d --progress --colors --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel-polyfill": "^6.16.0",
|
||||
@ -31,15 +25,20 @@
|
||||
"devDependencies": {
|
||||
"axios": "^0.15.2",
|
||||
"babel": "^6.5.2",
|
||||
"babel-core": "^6.18.2",
|
||||
"babel-loader": "^6.2.7",
|
||||
"babel-preset-es2015": "^6.18.0",
|
||||
"babel-preset-latest": "^6.16.0",
|
||||
"babel-preset-react": "^6.16.0",
|
||||
"css-loader": "^0.26.0",
|
||||
"del": "^2.2.2",
|
||||
"fontify": "0.0.2",
|
||||
"file-loader": "^0.9.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-babel": "^6.1.2",
|
||||
"gulp-less": "^3.3.0",
|
||||
"less": "^2.7.1",
|
||||
"less-loader": "^2.2.3",
|
||||
"style-loader": "^0.13.1",
|
||||
"url-loader": "^0.5.7",
|
||||
"webpack-stream": "^3.2.0"
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,6 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Canapé</title>
|
||||
|
||||
<link href="/css/app.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -1,4 +1,13 @@
|
||||
import 'babel-polyfill'
|
||||
// Html page
|
||||
import 'file-loader?name=[name].[ext]!../index.html'
|
||||
|
||||
// Import default image
|
||||
import 'file-loader?name=img/[name].png!../img/noimage.png'
|
||||
|
||||
// Styles
|
||||
import '../less/app.less'
|
||||
|
||||
// React
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import { bindActionCreators } from 'redux'
|
||||
|
@ -1,5 +1,5 @@
|
||||
@import "bootstrap/less/bootstrap.less";
|
||||
@import "font-awesome/less/font-awesome.less";
|
||||
@import "~bootstrap/less/bootstrap.less";
|
||||
@import "~font-awesome/less/font-awesome.less";
|
||||
|
||||
body {
|
||||
padding-top: 70px;
|
||||
|
@ -1,29 +0,0 @@
|
||||
var webpack = require("webpack");
|
||||
|
||||
export default {
|
||||
output: {
|
||||
filename: 'app.js',
|
||||
},
|
||||
devtool: 'source-map',
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.jsx?$/,
|
||||
loader: 'babel-loader',
|
||||
exclude: [/node_modules/],
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new webpack.ProvidePlugin({
|
||||
$: "jquery",
|
||||
jQuery: "jquery"
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify('development')
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
extensions: ['', '.js', '.jsx'],
|
||||
},
|
||||
};
|
48
webpack.config.js
Normal file
48
webpack.config.js
Normal file
@ -0,0 +1,48 @@
|
||||
var webpack = require("webpack");
|
||||
var path = require("path");
|
||||
|
||||
var BUILD_DIR = path.resolve(__dirname, 'build/public/');
|
||||
var SRC_DIR = path.resolve(__dirname, 'src/public/js');
|
||||
|
||||
module.exports = {
|
||||
entry: path.join(SRC_DIR, 'app.js'),
|
||||
output: {
|
||||
path: BUILD_DIR,
|
||||
filename: 'js/app.js',
|
||||
},
|
||||
devtool: 'source-map',
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.jsx?$/,
|
||||
loader: 'babel-loader',
|
||||
exclude: /node_modules/,
|
||||
query: {
|
||||
compact: false,
|
||||
presets: ["es2015", "react" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
loader: 'style-loader!css-loader!less-loader',
|
||||
},
|
||||
{
|
||||
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
loader: "url-loader?limit=10000&mimetype=application/font-woff"
|
||||
|
||||
},
|
||||
{
|
||||
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
loader: "file-loader"
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify('development')
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
extensions: ['', '.js', '.jsx']
|
||||
},
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user