Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7833f9f

Browse files
authored
Add files via upload
1 parent c026727 commit 7833f9f

File tree

4 files changed

+72
-21
lines changed

4 files changed

+72
-21
lines changed

test-ang/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# angular-test
2-
3-
4-
This is the full test project
5-
6-
# Installation
7-
```bash
8-
cd test-ang
9-
npm install
10-
npm start
11-
```
12-
13-
Then go to [http://localhost:8080](http://localhost:8080) in your browser. Thank you
1+
# angular-test
2+
3+
4+
This is the full test project
5+
6+
# Installation
7+
```bash
8+
cd test-ang
9+
npm install
10+
npm start
11+
```
12+
13+
Then go to [http://localhost:8080](http://localhost:8080) in your browser. Thank you

test-ang/gulpfile.js

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,55 @@
11
var gulp = require('gulp');
2+
var gutil = require('gulp-util');
3+
var watch = require('gulp-watch');
4+
var ngAnnotate = require('gulp-ng-annotate');
25
var concat = require('gulp-concat');
36
var rename = require('gulp-rename');
47
var uglify = require('gulp-uglify');
8+
var webpack = require('webpack');
9+
var webpack_stream = require('webpack-stream');
10+
var WebpackDevServer = require('webpack-dev-server');
11+
var webpackConfig = require('./webpack.config.js');
12+
var browserSync = require('browser-sync').create();
513

614
var jsFiles = 'app/index.js',
7-
jsDest = 'dist/scripts';
15+
jsDest = 'app/dist/scripts';
816

917
gulp.task('scripts', function() {
1018
return gulp.src(jsFiles)
11-
.pipe(concat('scripts.js'))
19+
.pipe(webpack_stream())
20+
.pipe(rename('scripts.min.js'))
21+
.pipe(ngAnnotate({
22+
// true helps add where @ngInject is not used. It infers.
23+
// Doesn't work with resolve, so we must be explicit there
24+
add: true
25+
}))
26+
.pipe(uglify())
1227
.pipe(gulp.dest(jsDest))
28+
/* .pipe(concat('scripts.js'))
1329
.pipe(rename('scripts.min.js'))
1430
.pipe(uglify())
15-
.pipe(gulp.dest(jsDest));
31+
32+
.pipe(gulp.dest(jsDest));*/
33+
});
34+
gulp.task('default', ['scripts', 'webpack-server'])
35+
gulp.task('webpack-server', function (c) {
36+
var myConfig = Object.create(webpackConfig);
37+
console.log(myConfig);
38+
myConfig.devtool = 'eval';
39+
myConfig.debug = true;
40+
41+
// Start a webpack-dev-server
42+
new WebpackDevServer(webpack(myConfig), {
43+
stats: {
44+
colors: true
45+
},
46+
contentBase: './app'
47+
}).listen(myConfig.devServer.port, 'localhost', function (err) {
48+
if (err) {
49+
throw new gutil.PluginError('webpack-dev-server', err);
50+
}
51+
gutil.log('[webpack-dev-server]', 'http://localhost:8080/index.html');
52+
53+
// gutil.log(['myConfig'], myConfig);
1654
});
55+
});

test-ang/package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,24 @@
1717
"babel-core": "^6.18.0",
1818
"babel-loader": "^6.2.7",
1919
"babel-preset-es2015": "^6.18.0",
20+
"browser-sync": "^2.17.5",
2021
"gulp-concat": "^2.6.0",
2122
"gulp-jshint": "^2.0.2",
23+
"gulp-ng-annotate": "^2.0.0",
2224
"gulp-rename": "^1.2.2",
2325
"gulp-uglify": "^2.0.0",
26+
"gulp-util": "^3.0.7",
27+
"gulp-watch": "^4.3.10",
28+
"jshint": "^2.9.4",
2429
"jshint-stylish": "^2.2.1",
2530
"webpack": "^1.13.3",
26-
"webpack-dev-server": "^1.16.2"
31+
"webpack-dev-server": "^1.16.2",
32+
"webpack-stream": "^3.2.0"
2733
},
2834
"dependencies": {
2935
"angular": "^1.5.8",
3036
"angular-route": "^1.5.8",
31-
"gulp": "^3.9.1"
37+
"gulp": "^3.9.1",
38+
"gulp-jshint": "^2.0.2"
3239
}
3340
}

test-ang/webpack.config.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
module.exports = {
2-
context: __dirname + '/app',
3-
entry: './index.js',
2+
3+
entry: './app/index.js',
44
output: {
5-
path: __dirname + '/app',
5+
path: __dirname + '/',
6+
contentBase: __dirname,
67
publicPath: "",
78
filename: 'bundle.js'
89
},
10+
devServer: {
11+
inline: true,
12+
port: 8080
13+
}
914

1015
}

0 commit comments

Comments
 (0)