From e7c21434fe8d841baf76f0bcba8ada2ddaf21b54 Mon Sep 17 00:00:00 2001 From: Thomas W Date: Mon, 22 Aug 2016 14:59:54 +0200 Subject: [PATCH] added gulp workflow --- .gitattributes | 4 ++++ .gitignore | 1 + gulpfile.js | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 29 ++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 gulpfile.js create mode 100644 package.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..be46c87 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +package.json export-ignore +gulpfile.js export-ignore +.gitignore export-ignore +.gitattributes export-ignore \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40b878d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..019acda --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,51 @@ +// Include gulp +var gulp = require('gulp'); + +// Include Our Plugins +var rename = require( 'gulp-rename' ); +var uglify = require( 'gulp-uglify' ); +var rtlcss = require( 'gulp-rtlcss' ); +var autoprefixer = require( 'autoprefixer' ); +var postcss = require( 'gulp-postcss' ); +var sorting = require( 'postcss-sorting' ); +var wprtl = require( 'postcss-wprtl' ); + +// Minify JS +gulp.task( 'minifyjs', function() { + return gulp.src( ['js/navigation.js'] ) + .pipe( uglify() ) + .pipe( rename( { + suffix: '.min' + } ) ) + .pipe( gulp.dest('js') ); +}); + +// Clean up CSS +gulp.task( 'cleancss', function() { + return gulp.src( ['style.css', 'css/*.css'], { base: './' } ) + .pipe( postcss( [ autoprefixer() ] ) ) + .pipe( postcss( [ sorting( { 'preserve-empty-lines-between-children-rules': true } ) ] ) ) + .pipe( gulp.dest( './' ) ); +}); + +// WP RTL +gulp.task( 'wprtl', function () { + return gulp.src( 'style.css' ) + .pipe( postcss( [ wprtl() ] ) ) + .pipe( postcss( [ sorting( { 'preserve-empty-lines-between-children-rules': true } ) ] ) ) + .pipe( rename( 'rtl.css' ) ) + .pipe( gulp.dest( './' ) ); +}); + +// Flex RTL +gulp.task( 'flexrtl', function () { + return gulp.src( 'css/flexslider.css' ) + .pipe( rtlcss() ) + .pipe( rename( { + suffix: '-rtl' + } ) ) + .pipe( gulp.dest( 'css' ) ); +}); + +// Default Task +gulp.task( 'default', ['minifyjs', 'cleancss'] ); diff --git a/package.json b/package.json new file mode 100644 index 0000000..65e2d02 --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "name": "tortuga", + "version": "1.0.0", + "description": "WordPress Theme", + "main": "gulpfile.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ThemeZee/tortuga.git" + }, + "author": "Thomas Weichselbaumer (https://themezee.com)", + "license": "GPL-2.0", + "bugs": { + "url": "https://github.com/ThemeZee/tortuga/issues" + }, + "homepage": "https://github.com/ThemeZee/tortuga#readme", + "devDependencies": { + "autoprefixer": "^6.4.0", + "gulp": "^3.9.1", + "gulp-postcss": "^6.1.1", + "gulp-rename": "^1.2.2", + "gulp-rtlcss": "^1.0.0", + "gulp-uglify": "^2.0.0", + "postcss-sorting": "^1.6.1", + "postcss-wprtl": "^1.2.0" + } +}