var gulp = require('gulp');
var spritesmith = require('gulp.spritesmith');
gulp.task('sprite', function () {
var spriteData = gulp.src('images/*.png').pipe(spritesmith({
imgName: 'sprite.png',
cssName: 'sprite.css'
}));
spriteData.css.pipe(gulp.dest('path/to/output/')); // CSS
return spriteData.img.pipe(gulp.dest('path/to/output/')); // IMG
});
var randomColor = {
list: [
'rgb(255,255,0)',
'rgb(255,0,0)',
'rgb(0,255,0)',
'rgb(0,51,0)'
],
already: [],
random: function () {
return this.list[Math.floor(Math.random() * this.list.length)];
},
get: function () {
var color = this.random();
if (this.already.length >= this.list.length) {
this.already = [];
return color;
}
if (this.already.indexOf(color) !== -1) {
return this.get();
} else {
this.already.push(color);
return color;
}
}
};
var task = function(name, path, options) {
options = options || {};
return gulp.task(name, function(cb) {
var call = require(path).call(this, options);
return call(cb);
});
};
app
|__ pages
|__ index.pug
|__ category.pug
|__ blocks
|__ title
|__ logo
|__ button
app
|__ styles
|__ fonts
|__ roboto.woff2
|__ img
|__ sprite.svg
|__ bg.svg
|__ main.css
|__ scripts
|__ main.js
|__ jquery.min.js
|__ static
|__ logo
|__ logo.svg
index.html
category.html
var total = 0, count = 1;
while ( count <= 10) {
total = total + count;
count = count + 1;
}
# 1
while ( count <= 10) {
total = 0 + 1;
count = 1 + 1;
}
// total = 1
// count = 2
# 2
while ( count <= 10) {
total = 1 + 2;
count = 2 + 1;
}
// total = 3
// count = 3
# 3
while ( count <= 10) {
total = 3 + 3;
count = 3 + 1;
}
// total = 6
// count = 4
# 4
while ( count <= 10) {
total = 6 + 4;
count = 4 + 1;
}
// total = 10
// count = 5
# 5
while ( count <= 10) {
total = 10 + 5;
count = 5 + 1;
}
// total = 15
// count = 6
# 6
while ( count <= 10) {
total = 15 + 6;
count = 6 + 1;
}
// total = 21
// count = 7
# 7
while ( count <= 10) {
total = 21 + 7;
count = 7 + 1;
}
// total = 28
// count = 8
# 8
while ( count <= 10) {
total = 28 + 8;
count = 8 + 1;
}
// total = 36
// count = 9
# 9
while ( count <= 10) {
total = 36 + 9;
count = 9 + 1;
}
// total = 45
// count = 10
# 10
while ( count <= 10) {
total = 45 + 10;
count = 10 + 1;
}
// total = 55
// count = 11