Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completed Skills Assessment #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Added uglified js.
  • Loading branch information
simeon-smith committed Sep 15, 2020
commit 469805328cb91c9512cd9d44ef24f76e4043a113
2 changes: 1 addition & 1 deletion Project Setup Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ Run `npm run build` to compile the SCSS, JS and copy the HTML into the build dir

### Serve

Run `npm start` to compile the SCSS< JS and copy the HTML into the build directory. This will automatically start a dev server and should open it up in the browser. The dev server uses `0.0.0.0` which can be access locally through `localhost` and the automatically selected port (i.e. `localhost:3000`). It can also be accessed through the IP of your current machine and the port from any other machine in your local network (i.e. `192.168.86.111:3000`).
Run `npm start` to compile the SCSS JS and copy the HTML into the build directory. This will automatically start a dev server and should open it up in the browser. The dev server uses `0.0.0.0` which can be access locally through `localhost` and the automatically selected port (i.e. `localhost:3000`). It can also be accessed through the IP of your current machine and the port from any other machine in your local network (i.e. `192.168.86.111:3000`).
19 changes: 17 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const browserSync = require('browser-sync').create();
const babel = require('gulp-babel');
const uglify = require('gulp-uglify');

sass.compiler = require('node-sass');

Expand Down Expand Up @@ -66,9 +67,23 @@ function buildSCSS() {
.pipe(gulp.dest('./build/css'));
}

function buildJS() {
postCssPlugins.push(cssnano());
return gulp
.src('./src/js/index.js')
.pipe(
babel({
presets: ['@babel/env'],
}),
)
.pipe(uglify())
.pipe(gulp.dest('./build/js'))
.pipe(browserSync.stream());
}

gulp.task(
'watch',
gulp.series(compileSCSS, compileJS, copyHTML, gulp.parallel(watchSCSS, watchJS, watchHTML, runBrowserSync)),
);
gulp.task('build', gulp.parallel(copyHTML, buildSCSS, compileJS));
gulp.task('start', gulp.series(copyHTML, gulp.parallel(buildSCSS, compileJS, runBrowserSync)));
gulp.task('build', gulp.parallel(copyHTML, buildSCSS, buildJS));
gulp.task('start', gulp.series(copyHTML, gulp.parallel(buildSCSS, buildJS, runBrowserSync)));
48 changes: 48 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"gulp-babel": "^8.0.0",
"gulp-postcss": "^8.0.0",
"gulp-sass": "^4.1.0",
"gulp-uglify": "^3.0.2",
"node-sass": "^4.14.1",
"prettier": "^2.1.1",
"stylelint": "^13.7.1",
Expand Down