Skip to content

Commit

Permalink
Fix build, create .min files, add header comment
Browse files Browse the repository at this point in the history
  • Loading branch information
hum-n committed Jul 19, 2019
1 parent ec92a47 commit a63bef3
Show file tree
Hide file tree
Showing 15 changed files with 134 additions and 3,381 deletions.
54 changes: 46 additions & 8 deletions build/build.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,64 @@
import gulp from 'gulp';
import postcss from 'gulp-postcss';
import rename from 'gulp-rename';
import cssnano from 'cssnano';
import merge from 'merge-stream';
import uglify from 'gulp-uglify';
import htmlmin from 'gulp-htmlmin';
import paths from '../mconfig.json';

function buildStyles() {
const stylesfiles = [
{
dest: paths.styles.dest
},
{
dest: paths.styles.docs.dest
}
];

const plugins = [
cssnano()
];

return gulp
.src(paths.styles.dest + '*.css')
.pipe(postcss(plugins))
.pipe(gulp.dest(paths.styles.dest));
const stylesStreams = stylesfiles.map((file) => {
return gulp
.src([file.dest+'*.css', '!'+file.dest+'*.min.css'])
.pipe(rename(function(file) {
if (file.basename == paths.styles.main) {
file.basename += '.min';
}
}))
.pipe(postcss(plugins))
.pipe(gulp.dest(file.dest));
});

return merge(stylesStreams);
}

function buildScripts() {
return gulp
.src(paths.scripts.dest + '*.js')
.pipe(uglify())
.pipe(gulp.dest(paths.scripts.dest));
const scriptsfiles = [
{
dest: paths.scripts.dest
},
{
dest: paths.scripts.docs.dest
}
];

const scriptsStreams = scriptsfiles.map((file) => {
return gulp
.src([file.dest+'*.js', '!'+file.dest+'*.esm.js', '!'+file.dest+'*.min.js'])
.pipe(rename(function(file) {
if (file.basename == paths.scripts.main) {
file.basename += '.min';
}
}))
.pipe(uglify())
.pipe(gulp.dest(file.dest));
});

return merge(scriptsStreams);
}

function buildViews() {
Expand Down
5 changes: 3 additions & 2 deletions build/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { rollup } from 'rollup';
import resolve from 'rollup-plugin-node-resolve';
import babel from 'rollup-plugin-babel';
import common from 'rollup-plugin-commonjs';
import merge from 'merge-stream';
import paths from '../mconfig.json';
import pkg from '../package.json';

function scripts() {
const files = [
Expand Down Expand Up @@ -41,7 +41,8 @@ function scripts() {
return bundle.write({
file: file.dest + '.js',
name: 'locomotiveScroll',
format: file.format
format: file.format,
banner: '/* locomotive-scroll v' + pkg.version + ' | MIT License | https://github.com/locomotivemtl/locomotive-scroll */'
});
})
});
Expand Down
3 changes: 3 additions & 0 deletions build/styles.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import gulp from 'gulp';
import sass from 'gulp-sass';
import autoprefixer from 'gulp-autoprefixer';
import header from 'gulp-header';
import merge from 'merge-stream';
import paths from '../mconfig.json';
import pkg from '../package.json';
import error from './error.js';
import { server } from './serve.js';

Expand All @@ -28,6 +30,7 @@ function styles() {
.pipe(autoprefixer({
cascade: false
}))
.pipe(header('/*! locomotive-scroll v' + pkg.version + ' | MIT License | https://github.com/locomotivemtl/locomotive-scroll */\n'))
.pipe(gulp.dest(file.dest))
.pipe(server.stream());
});
Expand Down
1 change: 1 addition & 0 deletions dist/locomotive-scroll.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*! locomotive-scroll v3.0.0 | MIT License | https://github.com/locomotivemtl/locomotive-scroll */
html.has-scroll-smooth {
overflow: hidden; }

Expand Down
1 change: 1 addition & 0 deletions dist/locomotive-scroll.esm.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* locomotive-scroll v3.0.0 | MIT License | https://github.com/locomotivemtl/locomotive-scroll */
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
Expand Down
1 change: 1 addition & 0 deletions dist/locomotive-scroll.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* locomotive-scroll v3.0.0 | MIT License | https://github.com/locomotivemtl/locomotive-scroll */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
Expand Down
1 change: 1 addition & 0 deletions dist/locomotive-scroll.min.css

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

1 change: 1 addition & 0 deletions dist/locomotive-scroll.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/dist/scripts/jquery-3.0.0.min.js

This file was deleted.

Loading

0 comments on commit a63bef3

Please sign in to comment.