Skip to content

Commit

Permalink
QFE: Renamed sass to scss
Browse files Browse the repository at this point in the history
gulpfile.js: Code optimizitaions

package.json: Added missing gulp extensions

style.css: Added version
  • Loading branch information
JunaidQadirB committed Feb 18, 2017
1 parent 8371fca commit 4ac9b54
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 45 deletions.
File renamed without changes.
75 changes: 33 additions & 42 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,79 +2,70 @@ var gulp = require('gulp');
var notify = require('gulp-notify');
var uglify = require('gulp-uglify');
var cleanCss = require('gulp-clean-css');
var sass = require('gulp-sass');
var scss = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var rm = require('gulp-rm');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var livereload = require('gulp-livereload');
var browserSync = require('browser-sync').create('Server');
var devUrl = "http://localhost/branch-test";

gulp.task('browser-sync', function () {
//watch files
var files = [
'./style.css',
'./*.php'
];

//initialize browsersync
var url = "localhost/PostDemo/";
browserSync.init(files, {
//browsersync with a php server
proxy: url,
notify: false
});
gulp.task('clean:build', function () {
return gulp.src('assets/build/**/*').pipe(rm());
});

/**
* Compile SCSS files
*/

gulp.task('sass', function () {
return gulp.src('assets/src/sass/*.scss')
.pipe(sass().on('error', sass.logError))
gulp.task('scss', function () {
return gulp.src('assets/src/scss/*.scss')
.pipe(scss().on('error', scss.logError))
.pipe(sourcemaps.init())
.pipe(cleanCss())
.pipe(sourcemaps.write())
.pipe(concat('all.min.css'))
.pipe(gulp.dest('assets/build/css/'))
.pipe(notify('SASS build complete!'))
.pipe(notify('scss build complete!'))
.pipe(browserSync.stream());
});

gulp.task('copyFonts', function () {
return gulp.src('node_modules/bootstrap-sass/assets/fonts/bootstrap/*')
gulp.task('fonts', function () {
return gulp.src('./node_modules/bootstrap-sass/assets/fonts/bootstrap/*')
.pipe(gulp.dest('assets/build/fonts/'))
.pipe(browserSync.stream());
});

gulp.task('clean:build', function () {
return gulp.src('assets/build/**/*').pipe(rm());
});

gulp.task('js', function () {
return gulp.src(
[
'node_modules/jquery/dist/jquery.js',
'node_modules/bootstrap-sass/assets/javascripts/bootstrap.js',
'assets/src/js/*.js'
'./node_modules/jquery/dist/jquery.js',
'./node_modules/bootstrap-sass/assets/javascripts/bootstrap.js',
'./assets/src/js/*.js'
]
).pipe(concat('all.min.js'))
.pipe(gulp.dest('assets/build/js'))
).pipe(sourcemaps.init())
.pipe(concat('all.min.js'))
.pipe(sourcemaps.write())
.pipe(uglify())
.pipe(gulp.dest('./assets/build/js'))
.pipe(notify('JS build complete!'))
.pipe(browserSync.stream());
});

gulp.task('watch', function () {
notify('Watch started!');
browserSync.init({
server: "/home/jeykeu/Code/wordpress/",

var files = [
'./style.css',
'./assets/src/scss/*.scss',
'./assets/src/js/*.js',
'./**/*.php',
'./**/*.twig'
];
browserSync.init(files, {
proxy: {
target: devUrl//Your wordpress URL
}
});
gulp.watch('assets/src/sass/*.scss', ['sass']);
gulp.watch('assets/src/js/*.js', ['js']);
gulp.watch(['copyFonts']);

gulp.watch('assets/src/scss/*.scss', ['scss']);
gulp.watch(['fonts']);
gulp.watch("*.twig").on('change', browserSync.reload);
});

gulp.task('default', ['watch']);
gulp.task('default', ['js', 'scss', 'fonts', 'watch']);
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "jeykeu-branch",
"description": "A WordPress starter theme based on Timber library and Bootstrap.",
"version": "2.0.0",
"version": "1.0.0",
"homepage": "http://branch.junaidqadir.com",
"author": "Junaid Qadir Shekhanzai <shekhanzai.baloch@gmail.com>",
"engines": {
"node": ">= 0.10.0"
},
"devDependencies": {
"bootstrap-sass": "^3.3.7",
"browser-sync": "^2.18.8",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-clean-css": "^3.0.2",
"gulp-concat": "^2.6.1",
"gulp-livereload": "^3.8.1",
"gulp-notify": "^3.0.0",
"gulp-rename": "^1.2.2",
"gulp-rm": "^1.0.2",
Expand All @@ -22,7 +22,6 @@
"gulp-uglify": "^2.0.1"
},
"dependencies": {
"bootstrap": "^3.3.2",
"jquery": "^2.1.3"
}
}
1 change: 1 addition & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Theme Name: Branch
Description: A WordPress starter theme based on Timber library and Bootstrap.
Version: 1.0.0
Author: JeyKeu <shekhanzai.baloch@gmail.com>
*/
@import url('assets/build/css/all.min.css');

0 comments on commit 4ac9b54

Please sign in to comment.