1
0
mirror of https://github.com/ascribe/wp-theme synced 2024-12-22 09:13:38 +01:00

switch to gulp, browser sync, start structuring styles/js

This commit is contained in:
Matthias Kretschmann 2015-12-11 13:51:46 +01:00
parent 4fa1fbd3c9
commit 1687a72e6a
24 changed files with 287 additions and 339 deletions

View File

@ -1,126 +0,0 @@
module.exports = function( grunt ) {
// Project configuration
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
concat: {
options: {
stripBanners: true,
banner: '/*! <%= pkg.title %> - v<%= pkg.version %>\n' +
' * <%= pkg.homepage %>\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %>;' +
' * Licensed GPLv2+' +
' */\n'
},
main: {
src: [
'assets/js/src/ascribe.js'
],
dest: 'assets/js/ascribe.js'
}
},
jshint: {
all: [
'Gruntfile.js',
'assets/js/src/**/*.js',
'assets/js/test/**/*.js'
]
},
uglify: {
all: {
files: {
'assets/js/ascribe.min.js': ['assets/js/ascribe.js']
},
options: {
banner: '/*! <%= pkg.title %> - v<%= pkg.version %>\n' +
' * <%= pkg.homepage %>\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %>;' +
' * Licensed GPLv2+' +
' */\n',
mangle: {
except: ['jQuery']
}
}
}
},
less: {
all: {
options: {
sourceMap: false
},
files: {
'assets/css/ascribe.css': 'assets/css/less/ascribe.less'
}
}
},
postcss: {
dist: {
options: {
processors: [
require('autoprefixer-core')({browsers: 'last 2 versions'})
]
},
files: {
'assets/css/ascribe.css': [ 'assets/css/ascribe.css' ]
}
}
},
cssmin: {
options: {
banner: '/*! <%= pkg.title %> - v<%= pkg.version %>\n' +
' * <%=pkg.homepage %>\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %>;' +
' * Licensed GPLv2+' +
' */\n'
},
minify: {
expand: true,
cwd: 'assets/css/',
src: ['ascribe.css'],
dest: 'assets/css/',
ext: '.min.css'
}
},
watch: {
//livereload: {
// files: ['assets/css/*.css'],
// options: {
// livereload: true
// }
//},
styles: {
files: ['assets/css/less/**/*.less'],
tasks: ['less', 'postcss', 'cssmin'],
options: {
debounceDelay: 500
}
},
scripts: {
files: ['assets/js/src/**/*.js', 'assets/js/vendor/**/*.js'],
tasks: ['jshint', 'concat', 'uglify'],
options: {
debounceDelay: 500
}
}
}
} );
// Load tasks
require('load-grunt-tasks')(grunt);
// Register tasks
grunt.registerTask( 'css', ['less', 'postcss', 'cssmin'] );
grunt.registerTask( 'js', ['jshint', 'concat', 'uglify'] );
grunt.registerTask( 'default', ['css', 'js'] );
grunt.util.linefeed = '\n';
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

View File

@ -1,3 +0,0 @@
# Styles
Only final CSS styles should exist in this folder. If you are using SASS, LESS, autoprefixer, or some other pre-processor, please place your raw source files in a subdirectory.

View File

@ -1,7 +0,0 @@
/**
* ascribe
* http://wordpress.org/themes
*
* Copyright (c) 2015 Territorial
* Licensed under the GPLv2+ license.
*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1007 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,15 +1,12 @@
$(document).ready(function(){
$('#more-articles').click(function(e){
e.preventDefault();
$.ajax({
url: ajaxpagination.ajaxurl,
type: 'post',
data: {
action: 'ajax_pagination'
},
success: function( result ) {
alert( result );
}
})
});
});
/**
** ascribe v0.0.1
** The best WordPress theme ever made!
** http://ascribe.io
**
** Territorial <us@territorial.ca>
**
**
** https://github.com/ascribe/wp-theme.git
**/
$(document).ready(function(){$("#more-articles").click(function(a){a.preventDefault(),$.ajax({url:ajaxpagination.ajaxurl,type:"post",data:{action:"ajax_pagination"},success:function(a){alert(a)}})})});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFqYXgtcGFnaW5hdGlvbi5qcyJdLCJuYW1lcyI6WyIkIiwiZG9jdW1lbnQiLCJyZWFkeSIsImNsaWNrIiwiZSIsInByZXZlbnREZWZhdWx0IiwiYWpheCIsInVybCIsImFqYXhwYWdpbmF0aW9uIiwiYWpheHVybCIsInR5cGUiLCJkYXRhIiwiYWN0aW9uIiwic3VjY2VzcyIsInJlc3VsdCIsImFsZXJ0Il0sIm1hcHBpbmdzIjoiQUFBQUEsRUFBRUMsVUFBVUMsTUFBTSxXQUNkRixFQUFFLGtCQUFrQkcsTUFBTSxTQUFTQyxHQUMvQkEsRUFBRUMsaUJBQ0ZMLEVBQUVNLE1BQ0VDLElBQUtDLGVBQWVDLFFBQ3BCQyxLQUFNLE9BQ05DLE1BQ0lDLE9BQVEsbUJBRVpDLFFBQVMsU0FBVUMsR0FDZkMsTUFBT0QiLCJmaWxlIjoiYWpheC1wYWdpbmF0aW9uLmpzIiwic291cmNlc0NvbnRlbnQiOlsiJChkb2N1bWVudCkucmVhZHkoZnVuY3Rpb24oKXtcbiAgICAkKCcjbW9yZS1hcnRpY2xlcycpLmNsaWNrKGZ1bmN0aW9uKGUpe1xuICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICQuYWpheCh7XG4gICAgICAgICAgICB1cmw6IGFqYXhwYWdpbmF0aW9uLmFqYXh1cmwsXG4gICAgICAgICAgICB0eXBlOiAncG9zdCcsXG4gICAgICAgICAgICBkYXRhOiB7XG4gICAgICAgICAgICAgICAgYWN0aW9uOiAnYWpheF9wYWdpbmF0aW9uJ1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHN1Y2Nlc3M6IGZ1bmN0aW9uKCByZXN1bHQgKSB7XG4gICAgICAgICAgICAgICAgYWxlcnQoIHJlc3VsdCApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KVxuICAgIH0pO1xufSk7Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9

12
assets/js/ajax-pagination.min.js vendored Normal file
View File

@ -0,0 +1,12 @@
/**
** ascribe v0.0.1
** The best WordPress theme ever made!
** http://ascribe.io
**
** Territorial <us@territorial.ca>
**
**
** https://github.com/ascribe/wp-theme.git
**/
$(document).ready(function(){$("#more-articles").click(function(a){a.preventDefault(),$.ajax({url:ajaxpagination.ajaxurl,type:"post",data:{action:"ajax_pagination"},success:function(a){alert(a)}})})});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFqYXgtcGFnaW5hdGlvbi5qcyJdLCJuYW1lcyI6WyIkIiwiZG9jdW1lbnQiLCJyZWFkeSIsImNsaWNrIiwiZSIsInByZXZlbnREZWZhdWx0IiwiYWpheCIsInVybCIsImFqYXhwYWdpbmF0aW9uIiwiYWpheHVybCIsInR5cGUiLCJkYXRhIiwiYWN0aW9uIiwic3VjY2VzcyIsInJlc3VsdCIsImFsZXJ0Il0sIm1hcHBpbmdzIjoiQUFBQUEsRUFBRUMsVUFBVUMsTUFBTSxXQUNkRixFQUFFLGtCQUFrQkcsTUFBTSxTQUFTQyxHQUMvQkEsRUFBRUMsaUJBQ0ZMLEVBQUVNLE1BQ0VDLElBQUtDLGVBQWVDLFFBQ3BCQyxLQUFNLE9BQ05DLE1BQ0lDLE9BQVEsbUJBRVpDLFFBQVMsU0FBVUMsR0FDZkMsTUFBT0QiLCJmaWxlIjoiYWpheC1wYWdpbmF0aW9uLmpzIiwic291cmNlc0NvbnRlbnQiOlsiJChkb2N1bWVudCkucmVhZHkoZnVuY3Rpb24oKXtcbiAgICAkKCcjbW9yZS1hcnRpY2xlcycpLmNsaWNrKGZ1bmN0aW9uKGUpe1xuICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICQuYWpheCh7XG4gICAgICAgICAgICB1cmw6IGFqYXhwYWdpbmF0aW9uLmFqYXh1cmwsXG4gICAgICAgICAgICB0eXBlOiAncG9zdCcsXG4gICAgICAgICAgICBkYXRhOiB7XG4gICAgICAgICAgICAgICAgYWN0aW9uOiAnYWpheF9wYWdpbmF0aW9uJ1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHN1Y2Nlc3M6IGZ1bmN0aW9uKCByZXN1bHQgKSB7XG4gICAgICAgICAgICAgICAgYWxlcnQoIHJlc3VsdCApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KVxuICAgIH0pO1xufSk7Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,15 @@
$(document).ready(function(){
$('#more-articles').click(function(e){
e.preventDefault();
$.ajax({
url: ajaxpagination.ajaxurl,
type: 'post',
data: {
action: 'ajax_pagination'
},
success: function( result ) {
alert( result );
}
})
});
});

View File

@ -1,3 +1,6 @@
//=include ajax-pagination.js
$(document).ready(function(){
imgAttrRemover();
@ -101,5 +104,3 @@ $(document).ready(function(){
}
});

View File

@ -1,7 +1,22 @@
@import "../vendor/normalize.less";
@import "../vendor/print.less";
@import "branding.less";
@import "../helpers/helpers.less";
//
// Ascribe
// -----------------
// Main collection file
//
@node_modules: '../../node_modules';
// Normalize all the things
@import (inline) '@{node_modules}/normalize-css/normalize.css';
@import (inline) '@{node_modules}/normalize-opentype.css/normalize-opentype.css';
// Variables & Mixins
@import 'ascribe/_variables';
//@import "ascribe/_mixins';
@import 'ascribe/_branding.less';
@import 'ascribe/_helpers.less';
@import 'vendor/print.less';
// HEADER
@chevronOffsetHeader: 60px;

View File

@ -20,21 +20,6 @@ a {
}
}
//COLOURS
@blueDeep: #121417;
@blueMedium: #003C69;
@blueBright: #67C4DA;
@blueLight: #d7e9ef;
@pink: #D8127D;
@white: #fff;
@greyBg: #fbfbfb;
@greySocial: #b8b8b8;
@greyHr: #979797;
@greyFooter: #8c8c8c;
@greyText: #595959;
@blackish: #1e1e1e;
@black: #000;
//FONTS
.fontLight {

View File

@ -0,0 +1,21 @@
//
// Ascribe
// -----------------
// Variables
//
// COLORS
@blueDeep: #121417;
@blueMedium: #003C69;
@blueBright: #67C4DA;
@blueLight: #d7e9ef;
@pink: #D8127D;
@white: #fff;
@greyBg: #fbfbfb;
@greySocial: #b8b8b8;
@greyHr: #979797;
@greyFooter: #8c8c8c;
@greyText: #595959;
@blackish: #1e1e1e;
@black: #000;

122
gulpfile.js Normal file
View File

@ -0,0 +1,122 @@
'use strict';
// load plugins
var $ = require('gulp-load-plugins')();
// manually require modules that won't get picked up by gulp-load-plugins
var gulp = require('gulp'),
chalk = require('chalk'),
pkg = require('./package.json'),
browser = require('browser-sync');
// handle errors
var onError = function(error) {
console.log(chalk.red('You fucked up:', error.message, 'on line' , error.lineNumber));
this.emit('end');
}
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// Terminal Banner
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
console.log("");
console.log(chalk.gray(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>"));
console.log(chalk.cyan(" ┌─┐┌─┐┌─┐┬─┐┬┌┐ ┌─┐"));
console.log(chalk.cyan(" ├─┤└─┐│ ├┬┘│├┴┐├┤ "));
console.log(chalk.cyan(" ┴ ┴└─┘└─┘┴└─┴└─┘└─┘"));
console.log(chalk.gray(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>"));
console.log("");
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// Config
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// Browsers to target when prefixing CSS.
var COMPATIBILITY = ['last 2 versions', 'ie >= 10'];
// paths
var SRC = './',
DIST = './';
// code banner
var BANNER = [
'/**',
' ** <%= pkg.name %> v<%= pkg.version %>',
' ** <%= pkg.description %>',
' ** <%= pkg.homepage %>',
' **',
' ** <%= pkg.author.name %> <<%= pkg.author.email %>>',
' **',
' ** ',
' ** <%= pkg.repository.url %> ',
' **/',
''
].join('\n');
// local dev server stuff
var PROXY = 'http://localhost:8888'
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// Tasks
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// Styles
//
gulp.task('css', function() {
return gulp.src(SRC + 'assets/less/ascribe.less')
.pipe($.sourcemaps.init())
.pipe($.less()).on('error', onError)
.pipe($.autoprefixer({ browsers: COMPATIBILITY }))
.pipe($.cssmin())
.pipe($.sourcemaps.write())
.pipe($.header(BANNER, { pkg: pkg }))
.pipe(gulp.dest(DIST + 'assets/css/'))
.pipe($.rename({ suffix: '.min' }))
.pipe(gulp.dest(DIST + 'assets/css/'))
.pipe(browser.stream());
});
//
// JavaScript
//
gulp.task('js', function() {
return gulp.src(SRC + 'assets/js/src/ascribe.js')
.pipe($.sourcemaps.init())
.pipe($.include())
.pipe($.uglify()).on('error', onError)
.pipe($.sourcemaps.write())
.pipe($.header(BANNER, { pkg: pkg }))
.pipe(gulp.dest(DIST + 'assets/js/'))
.pipe($.rename({suffix: '.min'}))
.pipe(gulp.dest(DIST + 'assets/js/'));
});
//
// Browser sync
//
gulp.task('serve', function() {
browser.init({
proxy: PROXY
});
gulp.watch([SRC + 'assets/less/**/*'], ['css']);
gulp.watch([SRC + 'assets/js/src/**/*'], ['js']);
gulp.watch(SRC + '**/*').on('change', browser.reload);
});
//
// Dev Server
//
gulp.task('default', ['css', 'js', 'serve']);
//
// Production build
//
gulp.task('build', ['css', 'js']);

View File

@ -1,37 +1,48 @@
{
"name": "ascribe",
"title": "ascribe",
"description": "The best WordPress theme ever made!",
"version": "0.0.1",
"homepage": "http://wordpress.org/themes",
"repository": {
"type": "git",
"url": ""
"description": "The best WordPress theme ever made!",
"homepage": "http://ascribe.io",
"license": "",
"main": "gulpfile.js",
"scripts": {
"start": "gulp",
"build": "gulp build"
},
"author": {
"name": "Territorial",
"email": "us@territorial.ca",
"url": "http://territorial.ca"
},
"dependencies": {
"bootstrap": "^3.3.6",
"jquery": ">=2.1.4",
"normalize-css": ">=2.3.1",
"normalize-opentype.css": ">=0.2.4"
},
"devDependencies": {
"autoprefixer-core": "^5.2.1",
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compress": "^0.13.0",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-cssmin": "^0.12.3",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-less": "^1.0.1",
"grunt-contrib-qunit": "^0.7.0",
"grunt-contrib-uglify": "^0.9.1",
"grunt-contrib-watch": "^0.6.1",
"grunt-phpunit": "^0.3.6",
"grunt-postcss": "^0.5.4",
"grunt-sass": "^1.0.0",
"grunt-sftp-deploy": "^0.2.4",
"load-grunt-tasks": "^3.2.0",
"browser-sync": "^2.10.0",
"chalk": ">=1.0.0",
"gulp": ">=3.8.0",
"gulp-autoprefixer": ">=2.3.0",
"gulp-concat": ">=2.5.2",
"gulp-cssmin": ">=0.1.7",
"gulp-header": ">=1.2.2",
"gulp-if": ">=1.2.5",
"gulp-include": "^2.1.0",
"gulp-less": "^3.0.5",
"gulp-load-plugins": ">=0.10.0",
"gulp-rename": ">=1.2.2",
"gulp-sourcemaps": ">=1.6.0",
"gulp-uglify": ">=1.2.0",
"gulp-util": ">=3.0.6",
"qunitjs": "~1.18.0"
},
"keywords": []
"engines": {
"node": ">=0.10.29"
},
"repository": {
"type": "git",
"url": "https://github.com/ascribe/wp-theme.git"
}
}

View File

@ -1 +0,0 @@
{"/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css//ascribe.css":"2015-10-28T04:13:06.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css//ascribe.min.css":"2015-10-28T04:13:06.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css//readme.md":"2015-09-17T22:31:35.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css//less/ascribe.less":"2015-10-28T04:13:01.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/js//ascribe.js":"2015-10-28T01:31:28.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/js//ascribe.min.js":"2015-10-28T01:31:28.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/js//src/ascribe.js":"2015-10-28T01:31:13.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/js//vendor/readme.md":"2015-09-17T22:31:35.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css//helpers/helpers.less":"2015-10-16T20:25:19.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css//less/branding.less":"2015-10-27T20:21:01.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css//vendor/colorbox.css":"2015-08-30T20:38:35.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css//vendor/normalize.less":"2015-08-25T22:42:14.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css//vendor/print.less":"2015-07-02T21:25:38.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/js//vendor/retina/retina.min.js":"2015-08-18T23:30:10.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/controller//controller.inc.php":"2015-09-17T22:47:24.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/controller//init.php":"2015-09-25T23:50:20.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/controller//classes/Subtemplate.php":"2015-10-28T01:26:57.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/js//ajax-pagination.js":"2015-09-25T04:46:45.000Z"}