Reorganizes asset file structure
Separates assets into - Source assets: `assets` - Compiled assets: `dist` Edits assets.php to reflect changes Removes '.min' from filenames Fixes: - removes 'clean' from build step.
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,5 @@
|
|||||||
# Include your project-specific ignores in this file
|
# Include your project-specific ignores in this file
|
||||||
# Read about how to use .gitignore: https://help.github.com/articles/ignoring-files
|
# Read about how to use .gitignore: https://help.github.com/articles/ignoring-files
|
||||||
assets/dist
|
dist
|
||||||
bower_components
|
bower_components
|
||||||
node_modules
|
node_modules
|
||||||
|
|||||||
@@ -1,92 +0,0 @@
|
|||||||
//
|
|
||||||
// Bootstrap
|
|
||||||
//
|
|
||||||
// Comment out any unused components
|
|
||||||
// --------------------------------------------------
|
|
||||||
|
|
||||||
// Variables
|
|
||||||
@import "../../../bower_components/bootstrap/less/variables";
|
|
||||||
|
|
||||||
// Mixins: Utilities
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/hide-text";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/opacity";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/image";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/labels";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/reset-filter";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/resize";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/responsive-visibility";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/size";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/tab-focus";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/text-emphasis";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/text-overflow";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/vendor-prefixes";
|
|
||||||
|
|
||||||
// Mixins: Components
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/alerts";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/buttons";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/panels";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/pagination";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/list-group";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/nav-divider";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/forms";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/progress-bar";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/table-row";
|
|
||||||
|
|
||||||
// Mixins: Skins
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/background-variant";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/border-radius";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/gradients";
|
|
||||||
|
|
||||||
// Mixins: Layout
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/clearfix";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/center-block";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/nav-vertical-align";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/grid-framework";
|
|
||||||
@import "../../../bower_components/bootstrap/less/mixins/grid";
|
|
||||||
|
|
||||||
// Reset
|
|
||||||
@import "../../../bower_components/bootstrap/less/normalize";
|
|
||||||
@import "../../../bower_components/bootstrap/less/print";
|
|
||||||
@import "../../../bower_components/bootstrap/less/glyphicons";
|
|
||||||
|
|
||||||
// Core CSS
|
|
||||||
@import "../../../bower_components/bootstrap/less/scaffolding";
|
|
||||||
@import "../../../bower_components/bootstrap/less/type";
|
|
||||||
@import "../../../bower_components/bootstrap/less/code";
|
|
||||||
@import "../../../bower_components/bootstrap/less/grid";
|
|
||||||
@import "../../../bower_components/bootstrap/less/tables";
|
|
||||||
@import "../../../bower_components/bootstrap/less/forms";
|
|
||||||
@import "../../../bower_components/bootstrap/less/buttons";
|
|
||||||
|
|
||||||
// Components
|
|
||||||
@import "../../../bower_components/bootstrap/less/component-animations";
|
|
||||||
@import "../../../bower_components/bootstrap/less/dropdowns";
|
|
||||||
@import "../../../bower_components/bootstrap/less/button-groups";
|
|
||||||
@import "../../../bower_components/bootstrap/less/input-groups";
|
|
||||||
@import "../../../bower_components/bootstrap/less/navs";
|
|
||||||
@import "../../../bower_components/bootstrap/less/navbar";
|
|
||||||
@import "../../../bower_components/bootstrap/less/breadcrumbs";
|
|
||||||
@import "../../../bower_components/bootstrap/less/pagination";
|
|
||||||
@import "../../../bower_components/bootstrap/less/pager";
|
|
||||||
@import "../../../bower_components/bootstrap/less/labels";
|
|
||||||
@import "../../../bower_components/bootstrap/less/badges";
|
|
||||||
@import "../../../bower_components/bootstrap/less/jumbotron";
|
|
||||||
@import "../../../bower_components/bootstrap/less/thumbnails";
|
|
||||||
@import "../../../bower_components/bootstrap/less/alerts";
|
|
||||||
@import "../../../bower_components/bootstrap/less/progress-bars";
|
|
||||||
@import "../../../bower_components/bootstrap/less/media";
|
|
||||||
@import "../../../bower_components/bootstrap/less/list-group";
|
|
||||||
@import "../../../bower_components/bootstrap/less/panels";
|
|
||||||
@import "../../../bower_components/bootstrap/less/responsive-embed";
|
|
||||||
@import "../../../bower_components/bootstrap/less/wells";
|
|
||||||
@import "../../../bower_components/bootstrap/less/close";
|
|
||||||
|
|
||||||
// Components w/ JavaScript
|
|
||||||
@import "../../../bower_components/bootstrap/less/modals";
|
|
||||||
@import "../../../bower_components/bootstrap/less/tooltip";
|
|
||||||
@import "../../../bower_components/bootstrap/less/popovers";
|
|
||||||
@import "../../../bower_components/bootstrap/less/carousel";
|
|
||||||
|
|
||||||
// Utility classes
|
|
||||||
@import "../../../bower_components/bootstrap/less/utilities";
|
|
||||||
@import "../../../bower_components/bootstrap/less/responsive-utilities";
|
|
||||||
92
assets/styles/_bootstrap.less
Normal file
92
assets/styles/_bootstrap.less
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
//
|
||||||
|
// Bootstrap
|
||||||
|
//
|
||||||
|
// Comment out any unused components
|
||||||
|
// --------------------------------------------------
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
@import "../../bower_components/bootstrap/less/variables";
|
||||||
|
|
||||||
|
// Mixins: Utilities
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/hide-text";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/opacity";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/image";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/labels";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/reset-filter";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/resize";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/responsive-visibility";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/size";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/tab-focus";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/text-emphasis";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/text-overflow";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/vendor-prefixes";
|
||||||
|
|
||||||
|
// Mixins: Components
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/alerts";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/buttons";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/panels";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/pagination";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/list-group";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/nav-divider";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/forms";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/progress-bar";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/table-row";
|
||||||
|
|
||||||
|
// Mixins: Skins
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/background-variant";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/border-radius";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/gradients";
|
||||||
|
|
||||||
|
// Mixins: Layout
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/clearfix";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/center-block";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/nav-vertical-align";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/grid-framework";
|
||||||
|
@import "../../bower_components/bootstrap/less/mixins/grid";
|
||||||
|
|
||||||
|
// Reset
|
||||||
|
@import "../../bower_components/bootstrap/less/normalize";
|
||||||
|
@import "../../bower_components/bootstrap/less/print";
|
||||||
|
@import "../../bower_components/bootstrap/less/glyphicons";
|
||||||
|
|
||||||
|
// Core CSS
|
||||||
|
@import "../../bower_components/bootstrap/less/scaffolding";
|
||||||
|
@import "../../bower_components/bootstrap/less/type";
|
||||||
|
@import "../../bower_components/bootstrap/less/code";
|
||||||
|
@import "../../bower_components/bootstrap/less/grid";
|
||||||
|
@import "../../bower_components/bootstrap/less/tables";
|
||||||
|
@import "../../bower_components/bootstrap/less/forms";
|
||||||
|
@import "../../bower_components/bootstrap/less/buttons";
|
||||||
|
|
||||||
|
// Components
|
||||||
|
@import "../../bower_components/bootstrap/less/component-animations";
|
||||||
|
@import "../../bower_components/bootstrap/less/dropdowns";
|
||||||
|
@import "../../bower_components/bootstrap/less/button-groups";
|
||||||
|
@import "../../bower_components/bootstrap/less/input-groups";
|
||||||
|
@import "../../bower_components/bootstrap/less/navs";
|
||||||
|
@import "../../bower_components/bootstrap/less/navbar";
|
||||||
|
@import "../../bower_components/bootstrap/less/breadcrumbs";
|
||||||
|
@import "../../bower_components/bootstrap/less/pagination";
|
||||||
|
@import "../../bower_components/bootstrap/less/pager";
|
||||||
|
@import "../../bower_components/bootstrap/less/labels";
|
||||||
|
@import "../../bower_components/bootstrap/less/badges";
|
||||||
|
@import "../../bower_components/bootstrap/less/jumbotron";
|
||||||
|
@import "../../bower_components/bootstrap/less/thumbnails";
|
||||||
|
@import "../../bower_components/bootstrap/less/alerts";
|
||||||
|
@import "../../bower_components/bootstrap/less/progress-bars";
|
||||||
|
@import "../../bower_components/bootstrap/less/media";
|
||||||
|
@import "../../bower_components/bootstrap/less/list-group";
|
||||||
|
@import "../../bower_components/bootstrap/less/panels";
|
||||||
|
@import "../../bower_components/bootstrap/less/responsive-embed";
|
||||||
|
@import "../../bower_components/bootstrap/less/wells";
|
||||||
|
@import "../../bower_components/bootstrap/less/close";
|
||||||
|
|
||||||
|
// Components w/ JavaScript
|
||||||
|
@import "../../bower_components/bootstrap/less/modals";
|
||||||
|
@import "../../bower_components/bootstrap/less/tooltip";
|
||||||
|
@import "../../bower_components/bootstrap/less/popovers";
|
||||||
|
@import "../../bower_components/bootstrap/less/carousel";
|
||||||
|
|
||||||
|
// Utility classes
|
||||||
|
@import "../../bower_components/bootstrap/less/utilities";
|
||||||
|
@import "../../bower_components/bootstrap/less/responsive-utilities";
|
||||||
83
gulpfile.js
83
gulpfile.js
@@ -3,21 +3,26 @@ var gulp = require('gulp');
|
|||||||
|
|
||||||
var $ = require('gulp-load-plugins')();
|
var $ = require('gulp-load-plugins')();
|
||||||
|
|
||||||
|
var build = {
|
||||||
|
src: 'assets/',
|
||||||
|
dist: 'dist/'
|
||||||
|
};
|
||||||
|
|
||||||
var paths = {
|
var paths = {
|
||||||
scripts: [
|
scripts: [
|
||||||
'assets/src/js/**/*'
|
build.src + 'scripts/**/*'
|
||||||
],
|
],
|
||||||
jshint: [
|
jshint: [
|
||||||
'bower.json',
|
'bower.json',
|
||||||
'gulpfile.js',
|
'gulpfile.js',
|
||||||
'assets/src/js/**/*'
|
build.src + 'scripts/**/*'
|
||||||
],
|
],
|
||||||
less: 'assets/src/less/main.less',
|
styles: build.src + 'styles/main.less',
|
||||||
editorStyle: 'assets/src/less/editor-style.less'
|
editorStyle: build.src + 'styles/editor-style.less'
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.task('less:dev', function() {
|
gulp.task('styles:dev', function() {
|
||||||
return gulp.src(paths.less)
|
return gulp.src(paths.styles)
|
||||||
.pipe($.plumber())
|
.pipe($.plumber())
|
||||||
.pipe($.sourcemaps.init())
|
.pipe($.sourcemaps.init())
|
||||||
.pipe($.less()).on('error', function(err) {
|
.pipe($.less()).on('error', function(err) {
|
||||||
@@ -25,32 +30,32 @@ gulp.task('less:dev', function() {
|
|||||||
})
|
})
|
||||||
.pipe($.autoprefixer('last 2 versions', 'ie 8', 'ie 9', 'android 2.3', 'android 4', 'opera 12'))
|
.pipe($.autoprefixer('last 2 versions', 'ie 8', 'ie 9', 'android 2.3', 'android 4', 'opera 12'))
|
||||||
.pipe($.sourcemaps.write())
|
.pipe($.sourcemaps.write())
|
||||||
.pipe($.rename('./main.css'))
|
.pipe($.rename('main.css'))
|
||||||
.pipe(gulp.dest('assets/dist/css'))
|
.pipe(gulp.dest(build.dist + 'styles'))
|
||||||
.pipe($.livereload({ auto: false }));
|
.pipe($.livereload({ auto: false }));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('less:build', function() {
|
gulp.task('styles:build', function() {
|
||||||
return gulp.src(paths.less)
|
return gulp.src(paths.styles)
|
||||||
.pipe($.plumber())
|
.pipe($.plumber())
|
||||||
.pipe($.less()).on('error', function(err) {
|
.pipe($.less()).on('error', function(err) {
|
||||||
console.warn(err.message);
|
console.warn(err.message);
|
||||||
})
|
})
|
||||||
.pipe($.autoprefixer('last 2 versions', 'ie 9', 'android 2.3', 'android 4', 'opera 12'))
|
.pipe($.autoprefixer('last 2 versions', 'ie 9', 'android 2.3', 'android 4', 'opera 12'))
|
||||||
.pipe($.rename('./main.min.css'))
|
.pipe($.rename('main.css'))
|
||||||
.pipe($.minifyCss())
|
.pipe($.minifyCss())
|
||||||
.pipe(gulp.dest('assets/dist/css'));
|
.pipe(gulp.dest(build.dist + 'styles'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('less:editorStyle', function() {
|
gulp.task('styles:editorStyle', function() {
|
||||||
return gulp.src(paths.editorStyle)
|
return gulp.src(paths.editorStyle)
|
||||||
.pipe($.plumber())
|
.pipe($.plumber())
|
||||||
.pipe($.less()).on('error', function(err) {
|
.pipe($.less()).on('error', function(err) {
|
||||||
console.warn(err.message);
|
console.warn(err.message);
|
||||||
})
|
})
|
||||||
.pipe($.autoprefixer('last 2 versions', 'ie 9', 'android 2.3', 'android 4', 'opera 12'))
|
.pipe($.autoprefixer('last 2 versions', 'ie 9', 'android 2.3', 'android 4', 'opera 12'))
|
||||||
.pipe($.rename('./editor-style.css'))
|
.pipe($.rename('editor-style.css'))
|
||||||
.pipe(gulp.dest('assets/dist/css'));
|
.pipe(gulp.dest(build.dist + 'styles'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('jshint', function() {
|
gulp.task('jshint', function() {
|
||||||
@@ -60,73 +65,73 @@ gulp.task('jshint', function() {
|
|||||||
.pipe($.jshint.reporter('fail'));
|
.pipe($.jshint.reporter('fail'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('js:dev', ['jshint'], function() {
|
gulp.task('scripts:dev', ['jshint'], function() {
|
||||||
return gulp.src(require('main-bower-files')().concat(paths.scripts))
|
return gulp.src(require('main-bower-files')().concat(paths.scripts))
|
||||||
.pipe($.filter('**/*.js'))
|
.pipe($.filter('**/*.js'))
|
||||||
.pipe($.concat('./scripts.js'))
|
.pipe($.concat('scripts.js'))
|
||||||
.pipe(gulp.dest('assets/dist/js'))
|
.pipe(gulp.dest(build.dist + 'scripts'))
|
||||||
.pipe($.livereload({ auto: false }));
|
.pipe($.livereload({ auto: false }));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('js:build', ['jshint'], function() {
|
gulp.task('scripts:build', ['jshint'], function() {
|
||||||
return gulp.src(require('main-bower-files')().concat(paths.scripts))
|
return gulp.src(require('main-bower-files')().concat(paths.scripts))
|
||||||
.pipe($.filter('**/*.js'))
|
.pipe($.filter('**/*.js'))
|
||||||
.pipe($.concat('./scripts.min.js'))
|
.pipe($.concat('scripts.js'))
|
||||||
.pipe($.uglify())
|
.pipe($.uglify())
|
||||||
.pipe(gulp.dest('assets/dist/js'));
|
.pipe(gulp.dest(build.dist + 'scripts'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('copy:fonts', function() {
|
gulp.task('copy:fonts', function() {
|
||||||
return gulp.src(require('main-bower-files')().concat('asset/src/fonts/**/*'))
|
return gulp.src(require('main-bower-files')().concat(build.src + 'fonts/**/*'))
|
||||||
.pipe($.filter('**/*.{eot,svg,ttf,woff}'))
|
.pipe($.filter('**/*.{eot,svg,ttf,woff}'))
|
||||||
.pipe(gulp.dest('assets/dist/fonts'));
|
.pipe(gulp.dest(build.dist + 'fonts'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('copy:jquery', function() {
|
gulp.task('copy:jquery', function() {
|
||||||
return gulp.src(['bower_components/jquery/dist/jquery.min.js'])
|
return gulp.src(['bower_components/jquery/dist/jquery.js'])
|
||||||
.pipe($.rename('jquery-1.11.1.min.js'))
|
.pipe($.rename('jquery.js'))
|
||||||
.pipe(gulp.dest('assets/dist/js'));
|
.pipe(gulp.dest(build.dist + 'scripts'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('copy:modernizr', function() {
|
gulp.task('copy:modernizr', function() {
|
||||||
return gulp.src(['bower_components/modernizr/modernizr.js'])
|
return gulp.src(['bower_components/modernizr/modernizr.js'])
|
||||||
.pipe($.uglify())
|
.pipe($.uglify())
|
||||||
.pipe($.rename('modernizr.min.js'))
|
.pipe($.rename('modernizr.js'))
|
||||||
.pipe(gulp.dest('assets/dist/js'));
|
.pipe(gulp.dest(build.dist + 'scripts'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('images', function() {
|
gulp.task('images', function() {
|
||||||
return gulp.src('assets/src/img/**/*')
|
return gulp.src(build.src + 'src/images/**/*')
|
||||||
.pipe($.imagemin({
|
.pipe($.imagemin({
|
||||||
progressive: true,
|
progressive: true,
|
||||||
interlaced: true
|
interlaced: true
|
||||||
}))
|
}))
|
||||||
.pipe(gulp.dest('assets/dist/img'));
|
.pipe(gulp.dest(build.dist + 'images'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('version', function() {
|
gulp.task('version', function() {
|
||||||
return gulp.src(['assets/dist/css/main.min.css', 'assets/dist/js/scripts.min.js'], { base: 'assets/dist' })
|
return gulp.src([build.dist + 'styles/main.css', build.dist + 'js/scripts.js'], { base: build.dist })
|
||||||
.pipe(gulp.dest('assets/dist'))
|
.pipe(gulp.dest(build.dist))
|
||||||
.pipe($.rev())
|
.pipe($.rev())
|
||||||
.pipe(gulp.dest('assets/dist'))
|
.pipe(gulp.dest(build.dist))
|
||||||
.pipe($.rev.manifest())
|
.pipe($.rev.manifest())
|
||||||
.pipe(gulp.dest('assets/dist'));
|
.pipe(gulp.dest(build.dist));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('clean', function() {
|
gulp.task('clean', function() {
|
||||||
return gulp.src(['assets/dist/css/main.min*', 'assets/dist/js/scripts.min*'], { read: false })
|
return gulp.src(build.dist, { read: false })
|
||||||
.pipe($.clean());
|
.pipe($.clean());
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('watch', function() {
|
gulp.task('watch', function() {
|
||||||
$.livereload.listen();
|
$.livereload.listen();
|
||||||
gulp.watch(['assets/src/less/**/*', 'bower.json'], ['less:dev']);
|
gulp.watch([build.src + 'styles/**/*', 'bower.json'], ['styles:dev']);
|
||||||
gulp.watch(['assets/src/js/**/*', 'bower.json'], ['jshint', 'js:dev']);
|
gulp.watch([build.src + 'scripts/**/*', 'bower.json'], ['jshint', 'scripts:dev']);
|
||||||
gulp.watch('**/*.php').on('change', function(file) {
|
gulp.watch('**/*.php').on('change', function(file) {
|
||||||
$.livereload.changed(file.path);
|
$.livereload.changed(file.path);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('default', ['less:dev', 'less:editorStyle', 'jshint', 'js:dev', 'copy:fonts', 'images']);
|
gulp.task('default', ['styles:dev', 'styles:editorStyle', 'jshint', 'scripts:dev', 'copy:fonts', 'images']);
|
||||||
gulp.task('dev', ['default']);
|
gulp.task('dev', ['default']);
|
||||||
gulp.task('build', ['clean', 'less:build', 'less:editorStyle', 'js:build', 'copy:fonts', 'copy:jquery', 'copy:modernizr', 'images', 'version']);
|
gulp.task('build', ['styles:build', 'styles:editorStyle', 'scripts:build', 'copy:fonts', 'copy:jquery', 'copy:modernizr', 'images', 'version']);
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
* Scripts and stylesheets
|
* Scripts and stylesheets
|
||||||
*
|
*
|
||||||
* Enqueue stylesheets in the following order:
|
* Enqueue stylesheets in the following order:
|
||||||
* 1. /theme/assets/dist/css/main.css
|
* 1. /theme/dist/styles/main.css
|
||||||
*
|
*
|
||||||
* Enqueue scripts in the following order:
|
* Enqueue scripts in the following order:
|
||||||
* 1. jquery-1.11.1.min.js via Google CDN
|
* 1. jquery-1.11.1.js via Google CDN
|
||||||
* 2. /theme/assets/dist/js/modernizr.min.js
|
* 2. /theme/dist/scripts/modernizr.js
|
||||||
* 3. /theme/assets/dist/js/scripts.js
|
* 3. /theme/dist/scripts/scripts.js
|
||||||
*
|
*
|
||||||
* Google Analytics is loaded after enqueued scripts if:
|
* Google Analytics is loaded after enqueued scripts if:
|
||||||
* - An ID has been defined in config.php
|
* - An ID has been defined in config.php
|
||||||
@@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
function roots_asset_path($filename_dev, $filename) {
|
function roots_asset_path($filename_dev, $filename) {
|
||||||
if (WP_ENV === 'development') {
|
if (WP_ENV === 'development') {
|
||||||
return get_template_directory_uri() . '/assets/dist/' . $filename_dev;
|
return get_template_directory_uri() . '/dist/' . $filename_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
$manifest_path = get_template_directory() . '/assets/dist/rev-manifest.json';
|
$manifest_path = get_template_directory() . '/dist/rev-manifest.json';
|
||||||
|
|
||||||
if (file_exists($manifest_path)) {
|
if (file_exists($manifest_path)) {
|
||||||
$manifest = json_decode(file_get_contents($manifest_path), true);
|
$manifest = json_decode(file_get_contents($manifest_path), true);
|
||||||
@@ -28,12 +28,12 @@ function roots_asset_path($filename_dev, $filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($filename, $manifest)) {
|
if (array_key_exists($filename, $manifest)) {
|
||||||
return get_template_directory_uri() . '/assets/dist/' . $manifest[$filename];
|
return get_template_directory_uri() . '/dist/' . $manifest[$filename];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function roots_assets() {
|
function roots_assets() {
|
||||||
wp_enqueue_style('roots_css', roots_asset_path('css/main.css', 'css/main.min.css'), false, null);
|
wp_enqueue_style('roots_css', roots_asset_path('styles/main.css', 'styles/main.css'), false, null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* jQuery is loaded using the same method from HTML5 Boilerplate:
|
* jQuery is loaded using the same method from HTML5 Boilerplate:
|
||||||
@@ -46,7 +46,7 @@ function roots_assets() {
|
|||||||
if (WP_ENV === 'development') {
|
if (WP_ENV === 'development') {
|
||||||
wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js', array(), null, true);
|
wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js', array(), null, true);
|
||||||
} else {
|
} else {
|
||||||
wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', array(), null, true);
|
wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js', array(), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2);
|
add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2);
|
||||||
@@ -56,9 +56,9 @@ function roots_assets() {
|
|||||||
wp_enqueue_script('comment-reply');
|
wp_enqueue_script('comment-reply');
|
||||||
}
|
}
|
||||||
|
|
||||||
wp_enqueue_script('modernizr', roots_asset_path('../../bower_components/modernizr/modernizr.js', 'js/modernizr.min.js'), array(), null, true);
|
wp_enqueue_script('modernizr', roots_asset_path('scripts/modernizr.js', 'scripts/modernizr.js'), array(), null, true);
|
||||||
wp_enqueue_script('jquery');
|
wp_enqueue_script('jquery');
|
||||||
wp_enqueue_script('roots_js', roots_asset_path('js/scripts.js', 'js/scripts.min.js'), array(), null, true);
|
wp_enqueue_script('roots_js', roots_asset_path('scripts/scripts.js', 'scripts/scripts.js'), array(), null, true);
|
||||||
}
|
}
|
||||||
add_action('wp_enqueue_scripts', 'roots_assets', 100);
|
add_action('wp_enqueue_scripts', 'roots_assets', 100);
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ function roots_jquery_local_fallback($src, $handle = null) {
|
|||||||
static $add_jquery_fallback = false;
|
static $add_jquery_fallback = false;
|
||||||
|
|
||||||
if ($add_jquery_fallback) {
|
if ($add_jquery_fallback) {
|
||||||
echo '<script>window.jQuery || document.write(\'<script src="' . get_template_directory_uri() . '/assets/dist/js/jquery-1.11.1.min.js"><\/script>\')</script>' . "\n";
|
echo '<script>window.jQuery || document.write(\'<script src="' . get_template_directory_uri() . '/dist/scripts/jquery.js"><\/script>\')</script>' . "\n";
|
||||||
$add_jquery_fallback = false;
|
$add_jquery_fallback = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ function roots_setup() {
|
|||||||
add_theme_support('html5', array('caption', 'comment-form', 'comment-list'));
|
add_theme_support('html5', array('caption', 'comment-form', 'comment-list'));
|
||||||
|
|
||||||
// Tell the TinyMCE editor to use a custom stylesheet
|
// Tell the TinyMCE editor to use a custom stylesheet
|
||||||
add_editor_style('/assets/dist/css/editor-style.css');
|
add_editor_style('/dist/css/editor-style.css');
|
||||||
}
|
}
|
||||||
add_action('after_setup_theme', 'roots_setup');
|
add_action('after_setup_theme', 'roots_setup');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user