Skip to content

Commit bef65ad

Browse files
committed
more update
1 parent 9585ce0 commit bef65ad

File tree

2 files changed

+51
-32
lines changed

2 files changed

+51
-32
lines changed

README.md

+26-25
Original file line numberDiff line numberDiff line change
@@ -11,73 +11,74 @@ If you don't have, [click here](https://nodejs.org/)
1111

1212

1313
#### 1. Check if you have it installed or not,
14-
15-
npm -v
16-
14+
```
15+
npm -v
16+
```
1717
and,
18-
19-
node -v
20-
18+
```
19+
node -v
20+
```
2121
you should see some version info in return.
2222

2323
#### 2. Install global packages
2424
run on any directory,
25-
26-
npm install -g gulp-cli node-gyp
27-
25+
```
26+
npm install -g gulp-cli node-gyp
27+
```
2828
in case of mac or linux, you might need to mention "sudo"
2929

3030

3131
#### 3. Now go to the directory where you want to place the project files using git bash
3232
(terminal for mac or linux)
3333
run the command,
34-
35-
git clone URL
36-
34+
```
35+
git clone URL
36+
```
3737
here URL is the http url you get from the repository page, [Click here to clone](https://github.com/tanmoythander/angular-gulp-boilerplate)
3838

3939
#### 4. now navigate to the project directory with cmd (terminal for mac or linux)</b><br>
4040
run the command,
41-
42-
npm install
43-
44-
wait for it to be completed. It usually takes 5-10 minutes to complete.<br>
45-
It will download all the dependencies, build the project and serve the build on browser<br><br>
41+
```
42+
npm install
43+
```
44+
wait for it to be completed. It usually takes 5-10 minutes to complete.
45+
It will download all the dependencies, build the project and serve the build on browser.
4646

4747
## Using the gulp commands
4848

4949

5050
#### 1. Serve the source
5151
File watching enabled (Development Mode)
5252
```
53-
gulp
53+
gulp
5454
```
5555
You should see the browser window opening address http://localhost:3000 (opens another port if unavailable).
5656

5757

58-
If you want to serve the source without watching file changes(Source Testing Mode),
58+
If you want to serve the source without watching file changes (Source Testing Mode),
5959
run this,
6060
```
61-
gulp serveSource
61+
gulp serveSource
6262
```
6363

6464

6565
#### 2. Build the source
6666
Build the source code into ./_build (Deployment Mode)
6767
```
68-
gulp build
68+
gulp build
6969
```
70-
Warning: it will delete previous build !!!
70+
Warning: It will delete previous build !!!
7171

7272

7373
#### 3. Serve the build
74-
Serve the ./_build/ without watch (Build Testing Mode)
74+
Serve the ./_build/ without watching file changes (Build Testing Mode)
7575

7676
```
77-
gulp serveBuild
77+
gulp serveBuild
7878
```
7979
you should see the browser window opening address http://localhost:3000 (opens another port if unavailable).
80-
Warning: it will delete previous build !!!
80+
81+
Warning: It will delete previous build !!!
8182

8283

8384
## Developer Hint

gulpfile.js

+25-7
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,17 @@ function images() {
9494
var images = size();
9595
return gulp.src('./images/**/*')
9696
.pipe(changed('./_build/images'))
97-
.pipe(imagemin({
98-
optimizationLevel: 3,
99-
progressive: true,
100-
interlaced: true
101-
}))
97+
.pipe(imagemin([
98+
imagemin.gifsicle({interlaced: true}),
99+
imagemin.jpegtran({progressive: true}),
100+
imagemin.optipng({optimizationLevel: 5}),
101+
imagemin.svgo({
102+
plugins: [
103+
{removeViewBox: true},
104+
{cleanupIDs: false}
105+
]
106+
})
107+
]))
102108
.pipe(gulp.dest('./_build/images'))
103109
.pipe(images)
104110
.pipe(notify({
@@ -152,7 +158,7 @@ function minCssJs() {
152158
.pipe(gulp.dest('./_build/'));
153159
}
154160

155-
// size
161+
// File sizes
156162
function sourceTemplateSize() {
157163
var sourceTemplate = size();
158164
return gulp.src(['*.html',
@@ -177,6 +183,17 @@ function sourceJsSize() {
177183
}
178184
}));
179185
}
186+
function sourceCssSize() {
187+
var sourceCss = size();
188+
return gulp.src('./styles/**/*.css')
189+
.pipe(sourceCss)
190+
.pipe(notify({
191+
onLast: true,
192+
message: function() {
193+
return 'Source CSS size ' + sourceCss.prettySize;
194+
}
195+
}));
196+
}
180197
function buildCssSize() {
181198
var buildCss = size();
182199
return gulp.src('./_build/css/style.min.css')
@@ -244,7 +261,8 @@ function watch() {
244261
gulp.parallel(syncReload, sourceTemplateSize));
245262
gulp.watch(['app/**/*.js', 'components/**/*.js', 'js/**/*.js'],
246263
gulp.parallel(syncReload, sourceJsSize, lint));
247-
gulp.watch('./styles/**/*.css', syncReload);
264+
gulp.watch('./styles/**/*.css',
265+
gulp.parallel(syncReload, sourceCssSize));
248266
}
249267

250268
// define output tasks

0 commit comments

Comments
 (0)