Skip to content

Commit

Permalink
Add gulp alternative instead of utilizing ant and guard.
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Feb 3, 2014
1 parent 4a5eca4 commit 02c88b6
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 51 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Composer
composer.lock
vendor/*

# Node.js
node_modules/*
14 changes: 0 additions & 14 deletions Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,3 @@ guard :phpunit2, :all_on_start => false, :tests_path => 'tests/', :cli => '--col
# Save app/models/User.php, and it will run app/tests/models/UserTest.php
watch(%r{^src/(.+)/(.+)\.php$}) { |m| "tests/#{m[1]}/#{m[2]}Test.php"}
end

guard 'shell' do
watch(%r{^public/css/(.+\.less)}) { |m|
n m[0], "Changed"
`ant minify-css`
}
end

guard 'shell' do
watch(%r{^public/js/(.+\.coffee)}) { |m|
n m[0], "Changed"
`ant minify-js`
}
end
27 changes: 1 addition & 26 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,6 @@
</copy>
</target>

<target name="minify-css" description="Minify the CSS">
<exec executable="lessc">
<arg value="${basedir}/public/css/orchestra.less"/>
<arg value="${basedir}/public/css/orchestra.css"/>
<arg value="--verbose"/>
<arg value="-x"/>
</exec>
</target>

<target name="minify-js" description="Minify the JavaScript">
<exec executable="java">
<arg value="-jar"/>
<arg value="${basedir}/vendor/packagist/yuicompressor-bin/bin/yuicompressor.jar"/>
<arg value="--charset"/>
<arg value="utf-8"/>
<arg value="--preserve-semi"/>
<arg value="--line-break"/>
<arg value="150"/>
<arg value="-o"/>
<arg value="${basedir}/public/js/orchestra.min.js"/>
<arg value="${basedir}/public/js/orchestra.js"/>
</exec>
</target>

<target name="lint" description="Perform syntax check of sourcecode files">
<apply executable="php" failonerror="false">
<arg value="-l" />
Expand Down Expand Up @@ -176,8 +152,7 @@
</target>

<target name="build" depends="update,generate"/>
<target name="minify" depends="minify-css,minify-js"/>
<target name="generate" depends="clean,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpunit,phpcb"/>
<target name="update" depends="composer-update,composer-dumpautoload,twbs,minify"/>
<target name="update" depends="composer-update,composer-dumpautoload,twbs"/>
<target name="quick-build" depends="composer-dumpautoload,generate"/>
</project>
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
},
"require-dev": {
"mockery/mockery": "0.8.*",
"phpunit/phpunit": "3.7.*",
"orchestra/testbench": "2.1.*",
"twbs/bootstrap": "~3@stable",
"packagist/yuicompressor-bin": "2.4.8"
"twbs/bootstrap": "~3@stable"
},
"extra": {
"branch-alias": {
Expand Down
46 changes: 46 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
var gulp = require('gulp'),
gutil = require('gulp-util'),
coffee = require('gulp-coffee'),
csso = require('gulp-csso'),
less = require('gulp-less'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify');

// Less
gulp.task('css', function () {
return gulp.src('public/css/orchestra.less')
.pipe(less())
.pipe(csso())
.pipe(gulp.dest('public/css'));
});

// Coffee
gulp.task('js', function () {
return gulp.src('public/js/orchestra.coffee')
.pipe(coffee().on('error', gutil.log))
.pipe(gulp.dest('public/js'));
});

// Minify JavaScript
gulp.task('uglify', function () {
var options = {
outSourceMaps: false,
output: {
max_line_len: 150
}
};

return gulp.src('public/js/orchestra.js')
.pipe(rename({suffix: '.min'}))
.pipe(uglify(options))
.pipe(gulp.dest('public/js'))
});

gulp.task('watch', function () {
gulp.watch('public/css/orchestra.less', ['css']);
gulp.watch('public/css/orchestra.coffee', ['js']);
gulp.watch('public/css/orchestra.js', ['uglify']);
});

// Default task.
gulp.task('default', ['css', 'js', 'uglify', 'watch']);
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"devDependencies": {
"gulp": "~3.5.1",
"gulp-coffee": "~1.4.1",
"gulp-csso": "~0.2.3",
"gulp-less": "~1.2.1",
"gulp-notify": "~0.4.0",
"gulp-rename": "~0.2.2",
"gulp-uglify": "~0.2.0",
"gulp-util": "~2.2.14"
}
}
2 changes: 1 addition & 1 deletion public/css/orchestra.css

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion public/js/orchestra.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Generated by CoffeeScript 1.6.3
(function() {
var Dispatcher, Javie, jQuery, root, setup_button_group, setup_helper, setup_pagination, setup_switcher;

Expand Down
13 changes: 6 additions & 7 deletions public/js/orchestra.min.js

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

0 comments on commit 02c88b6

Please sign in to comment.