Skip to content

Commit

Permalink
fix(gulp): Remove Bulma’s important from dist’sass
Browse files Browse the repository at this point in the history
  • Loading branch information
Wikiki committed Feb 11, 2018
1 parent f33f2fa commit 37bb5a9
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 41 deletions.
5 changes: 5 additions & 0 deletions dist/bulma-slider.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
(function () {
'use strict';

// Find output DOM associated to the DOM element passed as parameter
function findOutputForSlider(element) {
var idVal = element.id;
Expand Down Expand Up @@ -69,3 +72,5 @@ document.addEventListener('DOMContentLoaded', function() {
}
});
});

}());
3 changes: 2 additions & 1 deletion dist/bulma-slider.min.js

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

93 changes: 53 additions & 40 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var gulp = require('gulp');
var autoprefixer = require('autoprefixer');
var babel = require('gulp-babel');
var bump = require('gulp-bump');
var camelCase = require('camelcase');
var cleancss = require('gulp-clean-css');
var concat = require('gulp-concat');
var conventionalChangelog = require('gulp-conventional-changelog');
Expand All @@ -14,10 +15,12 @@ var fs = require('fs');
var git = require('gulp-git');
var gutil = require('gulp-util');
var postcss = require('gulp-postcss');
var rollup = require('gulp-better-rollup');
var runSequence = require('run-sequence');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var spawn = require('child_process').spawn;
var uglify = require('gulp-uglify');
var minify = require('gulp-babel-minify');

/**
* ----------------------------------------
Expand All @@ -44,27 +47,27 @@ var distJsFile = package.name + '.min.js';
* ----------------------------------------
*/

// Uses Sass compiler to process styles, adds vendor prefixes, minifies, then
// outputs file to the appropriate location.
gulp.task('build:styles', ['build:styles:copy'], function() {
return gulp.src([paths.bulma + bulmaSassFile, paths.src + mainSassFile])
.pipe(concat(globalSassFile))
.pipe(sass({
style: 'compressed',
includePaths: [paths.bulma]
}))
.pipe(concat(distCssFile))
.pipe(postcss([autoprefixer({browsers: ['last 2 versions']})]))
.pipe(cleancss())
.pipe(gulp.dest(paths.dest));
});

// Copy original sass file to dist
gulp.task('build:styles:copy', function() {
return gulp.src(paths.src + mainSassFile)
.pipe(concat(globalSassFile))
.pipe(gulp.dest(paths.dest));
});
// Uses Sass compiler to process styles, adds vendor prefixes, minifies, then
// outputs file to the appropriate location.
gulp.task('build:styles', ['build:styles:copy'], function() {
return gulp.src([paths.bulma + bulmaSassFile, paths.src + mainSassFile])
.pipe(concat(globalSassFile))
.pipe(sass({
style: 'compressed',
includePaths: [paths.bulma]
}))
.pipe(concat(distCssFile))
.pipe(postcss([autoprefixer({browsers: ['last 2 versions']})]))
.pipe(cleancss())
.pipe(gulp.dest(paths.dest));
});

// Copy original sass file to dist
gulp.task('build:styles:copy', function() {
return gulp.src(paths.src + mainSassFile)
.pipe(concat(globalSassFile))
.pipe(gulp.dest(paths.dest));
});

gulp.task('clean:styles', function(callback) {
del([
Expand All @@ -82,28 +85,38 @@ gulp.task('clean:styles', function(callback) {

// Concatenates and uglifies global JS files and outputs result to the
// appropriate location.
gulp.task('build:scripts', ['build:scripts:copy'], function() {
gulp.task('build:scripts', function() {
return gulp
.src([paths.src + paths.jsPattern])
.pipe(concat(distJsFile))
.pipe(babel({
"presets": [
["@babel/preset-env", {
"modules": "umd",
"targets": {
"browsers": ["last 2 versions"]
}
}]
]
.pipe(sourcemaps.init({
loadMaps: true
}))
.pipe(uglify())
.pipe(gulp.dest(paths.dest));
});

// Copy original sripts file to dist
gulp.task('build:scripts:copy', function() {
return gulp.src(paths.src + mainJsFile)
.pipe(rollup({
plugins: [babel({
babelrc: false,
sourceMaps: true,
exclude: 'node_modules/**',
presets: [
["@babel/preset-env", {
"modules": false,
"targets": {
"browsers": gutil.env.babelTarget ? gutil.env.babelTarget : ["last 2 versions"]
}
}]
]
})]
}, {
format: gutil.env.jsFormat ? gutil.env.jsFormat : 'iife',
name: camelCase(package.name)
}
))
.pipe(concat(globalJsFile))
.pipe(gulp.dest(paths.dest))
.pipe(concat(distJsFile))
.pipe(minify().on('error', function(err) {
gutil.log(gutil.colors.red('[Error]'), err.toString())
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest(paths.dest));
});

Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,25 @@
"@babel/preset-env": "^7.0.0-beta.39",
"babel-core": "^7.0.0-beta.3",
"bulma": "^0.6.2",
"camelcase": "^4.1.0",
"conventional-github-releaser": "^2.0.0",
"del": "^3.0.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^4.1.0",
"gulp-babel": "^7.0.1",
"gulp-babel-minify": "^0.3.0",
"gulp-better-rollup": "^3.0.0",
"gulp-bump": "^3.1.0",
"gulp-clean-css": "^3.9.2",
"gulp-concat": "^2.6.1",
"gulp-conventional-changelog": "^1.1.11",
"gulp-git": "^2.5.1",
"gulp-postcss": "^7.0.1",
"gulp-sass": "^3.1.0",
"gulp-sourcemaps": "^2.6.4",
"gulp-uglify": "^3.0.0",
"gulp-util": "^3.0.8",
"rollup-plugin-babel": "^3.0.3",
"run-sequence": "^2.2.1"
},
"files": [
Expand Down

0 comments on commit 37bb5a9

Please sign in to comment.