Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit a2bdd68

Browse files
committed
add gulpfile
1 parent 800c45d commit a2bdd68

File tree

8 files changed

+5977
-22
lines changed

8 files changed

+5977
-22
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
.idea/
2-
atomic-core/node_modules/
2+
node_modules/

GulpFile.js

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
var gulp = require("gulp"),
2+
sass = require("gulp-sass"),
3+
postcss = require("gulp-postcss"),
4+
autoprefixer = require("autoprefixer"),
5+
cssnano = require("cssnano"),
6+
sourcemaps = require("gulp-sourcemaps"),
7+
order = require("gulp-order"),
8+
concat = require("gulp-concat"),
9+
rename = require("gulp-rename"),
10+
uglify = require("gulp-uglify");
11+
12+
13+
14+
15+
var paths = {
16+
styles: {
17+
// By using styles/**/*.sass we're telling gulp to check all folders for any sass file
18+
src: "scss/**/*.scss",
19+
// Compiled files will end up in whichever folder it's found in (partials are not compiled)
20+
dest: "./css/"
21+
},
22+
scripts: {
23+
// By using styles/**/*.sass we're telling gulp to check all folders for any sass file
24+
src: "js/*.js",
25+
// Compiled files will end up in whichever folder it's found in (partials are not compiled)
26+
dest: "js/min"
27+
}
28+
};
29+
30+
function style() {
31+
return gulp
32+
.src(paths.styles.src)
33+
// Initialize sourcemaps before compilation starts
34+
.pipe(sourcemaps.init())
35+
.pipe(sass())
36+
.on("error", sass.logError)
37+
// Use postcss with autoprefixer and compress the compiled file using cssnano
38+
.pipe(postcss([autoprefixer(), cssnano()]))
39+
// Now add/write the sourcemaps
40+
.pipe(sourcemaps.write())
41+
.pipe(gulp.dest(paths.styles.dest))
42+
43+
}
44+
45+
function scripts() {
46+
return gulp
47+
.src(paths.scripts.src)
48+
// Initialize sourcemaps before compilation starts
49+
.pipe(sourcemaps.init())
50+
.pipe(order([
51+
'js/bootstrap.min.js',
52+
'js/matchheight.js',
53+
'js/main.js'
54+
]))
55+
.pipe(concat('site.js'))
56+
.pipe(gulp.dest('js/min'))
57+
.pipe(rename('site.min.js'))
58+
.pipe(uglify())
59+
.pipe(sourcemaps.write('maps'))
60+
.pipe(gulp.dest(paths.scripts.dest))
61+
62+
}
63+
64+
65+
66+
67+
function watch() {
68+
69+
gulp.watch(paths.styles.src, style);
70+
gulp.watch(paths.scripts.src, scripts);
71+
72+
}
73+
74+
75+
// Don't forget to expose the task!
76+
exports.watch = watch;
77+
78+
// Expose the task by exporting it
79+
// This allows you to run it from the commandline using
80+
// $ gulp style
81+
exports.style = style;
82+
exports.scripts = scripts;
83+
84+
/*
85+
* Specify if tasks run in series or parallel using `gulp.series` and `gulp.parallel`
86+
*/
87+
88+
var build = gulp.parallel(style, watch, scripts);
89+
90+
/*
91+
* You can still use `gulp.task` to expose tasks
92+
*/
93+
gulp.task('build', build);
94+
95+
/*
96+
* Define default task that can be called by just running `gulp` from cli
97+
*/
98+
gulp.task('default', build);
99+
100+
101+
102+
103+

css/main.css

Lines changed: 2 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/min/maps/site.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/min/site.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* js/clickme.js */
2+
3+
$('.click').click(function () {
4+
$(this).toggleClass('clickAnimate');
5+
});
6+
7+
/* js/row.js */

js/min/site.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)