Permalink
Browse files

Optimize gulp tasks

  • Loading branch information...
1 parent 54d30d6 commit d17c095d6c2d27ce7912342ec784ce93ecaedefe @ragingwind ragingwind committed Sep 24, 2014
Showing with 63 additions and 96 deletions.
  1. BIN app/images/logo-jquery@2x.png
  2. +19 −5 app/index.html
  3. +2 −3 app/scripts/main.js
  4. +21 −16 app/styles/main.css
  5. +21 −62 gulpfile.js
  6. +0 −10 package.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -5,14 +5,23 @@
<title>Quckstart for jQuery</title>
<meta name="description" content="">
<link rel="shortcut icon" href="/favicon.ico">
+
+ <!-- build:css styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
- <link rel="stylesheet" href="bower_components/chosen/chosen.css">
- <link rel="stylesheet" href="bower_components/iCheck/skins/all.css">
+ <!-- endbuild -->
+
+ <!-- build:css styles/vendor.css -->
+ <link rel="stylesheet" href="../bower_components/iCheck/skins/all.css">
+ <link rel="stylesheet" href="../bower_components/chosen/chosen.css">
+ <!-- endbuild -->
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1 id="slogan">Hello, Quick start</h1>
+ <h2>
+ <img class="logo" src="images/logo-jquery@2x.png">
+ </h2>
<p class="lead"></p>
</div>
<div class="row">
@@ -41,9 +50,14 @@ <h1 id="slogan">Hello, Quick start</h1>
</div>
</div>
- <script src="bower_components/jquery/dist/jquery.js"></script>
- <script src="bower_components/iCheck/iCheck.js"></script>
- <script src="bower_components/chosen/chosen.jquery.js"></script>
+ <!-- build:js scripts/vendor.js -->
+ <script src="../bower_components/jquery/dist/jquery.js"></script>
+ <script src="../bower_components/iCheck/iCheck.js"></script>
+ <script src="../bower_components/chosen/chosen.jquery.js"></script>
+ <!-- endbuild -->
+
+ <!-- build:js scripts/main.min.js -->
<script src="scripts/main.js"></script>
+ <!-- endbuild -->
</body>
</html>
View
@@ -22,13 +22,12 @@ $('#icheck-input').iCheck({
cursor: true,
checkboxClass: 'icheckbox_minimal',
radioClass: 'iradio_minimal',
- increaseArea: '20%' // optional
+ increaseArea: '20%'
});
// Handle checked event fired
$('#icheck-input input').on('ifChecked', function(e){
- console.log(e);
if (e.type === 'ifChecked') {
- $('#slogan').text($(e.target).val());
+ $('#slogan').text($(e.target).val());
}
});
View
@@ -13,49 +13,54 @@ html, body {
max-width: 730px;
}
+.container h4 {
+ font-size: 18px;
+ margin-top: 10px;
+ margin-bottom: 10px;
+ font-family: inherit;
+ font-weight: 500;
+ line-height: 1.1;
+ color: inherit;
+}
+
.jumbotron {
padding-top: 48px;
padding-bottom: 48px;
padding-right: 64px;
padding-left: 64px;
margin-bottom: 30px;
- background-color: #eee;
+ background-color: #0769AD;
text-align: center;
border-bottom: 1px solid #e5e5e5;
border-radius: 6px;
}
-.row {
- margin: 30px 0;
+.jumbotron h1 {
+ color:#fff;
+}
+
+.jumbotron h2 {
+ max-width: 300px
}
.row {
position: relative;
- min-height: 1px;
+ margin: 30px 0;
+ min-height: 10px;
padding-right: 15px;
padding-left: 15px;
}
-h4 {
- font-size: 18px;
- margin-top: 10px;
- margin-bottom: 10px;
- font-family: inherit;
- font-weight: 500;
- line-height: 1.1;
- color: inherit;
-}
-
ul#icheck-input {
padding: 0;
}
-#icheck-input li {
+ul#icheck-input li {
list-style-type: none;
padding: 0;
}
-#icheck-input label {
+ul#icheck-input label {
margin-left: 10px;
font-family: inherit;
font-size: 16px;
View
@@ -1,6 +1,6 @@
/**
*
- * Quickstart gulpfile.js, This has changed from Web Starter Kit
+ * Quickstart gulpfile.js, This has changed come from Web Starter Kit
*
* Licensed under Apache License, Copyright 2014 Google Inc.
* See the LICENSE for more details of licence
@@ -13,21 +13,8 @@ var $ = require('gulp-load-plugins')();
var del = require('del');
var runSequence = require('run-sequence');
var browserSync = require('browser-sync');
-var pagespeed = require('psi');
var reload = browserSync.reload;
-var AUTOPREFIXER_BROWSERS = [
- 'ie >= 10',
- 'ie_mob >= 10',
- 'ff >= 30',
- 'chrome >= 34',
- 'safari >= 7',
- 'opera >= 23',
- 'ios >= 7',
- 'android >= 4.4',
- 'bb >= 10'
-];
-
// Lint JavaScript
gulp.task('jshint', function () {
return gulp.src('app/scripts/**/*.js')
@@ -59,76 +46,52 @@ gulp.task('copy', function () {
.pipe($.size({title: 'copy'}));
});
-
-// Compile and Automatically Prefix Stylesheets
-gulp.task('styles', function () {
- // For best performance, don't add Sass partials to `gulp.src`
- return gulp.src([
- 'app/styles/**/*.css',
- ]).on('error', console.error.bind(console))
- .pipe($.autoprefixer({browsers: AUTOPREFIXER_BROWSERS}))
- .pipe(gulp.dest('.tmp/styles'))
- // Concatenate And Minify Styles
- .pipe($.if('*.css', $.csso()))
- .pipe(gulp.dest('dist/styles'))
- .pipe($.size({title: 'styles'}));
-});
-
// Scan Your HTML For Assets & Optimize Them
gulp.task('html', function () {
- var assets = $.useref.assets({searchPath: '{.tmp,app}'});
+ var assets = $.useref.assets({searchPath: ['app']});
- return gulp.src('app/**/*.html')
+ return gulp.src('app/**/*.html').on('error', console.error.bind(console))
.pipe(assets)
- // Concatenate And Minify JavaScript
.pipe($.if('*.js', $.uglify({preserveComments: 'some'})))
- // Remove Any Unused CSS
- // Note: If not using the Style Guide, you can delete it from
- // the next line to only include styles your project uses.
- .pipe($.if('*.css', $.uncss({
- html: [
- 'app/index.html',
- ],
- // CSS Selectors for UnCSS to ignore
- ignore: []
- })))
- // Concatenate And Minify Styles
- // In case you are still using useref build blocks
.pipe($.if('*.css', $.csso()))
.pipe(assets.restore())
.pipe($.useref())
- // Update Production Style Guide Paths
- .pipe($.replace('components/components.css', 'components/main.min.css'))
- // Minify Any HTML
.pipe($.if('*.html', $.minifyHtml()))
- // Output Files
.pipe(gulp.dest('dist'))
.pipe($.size({title: 'html'}));
});
+// Copy the files associated with components
+gulp.task('assets', function () {
+ return gulp.src([
+ 'bower_components/iCheck/skins/**/*',
+ '!bower_components/iCheck/skins/all.css',
+ 'bower_components/chosen/chosen-sprite@2x.png',
+ 'bower_components/chosen/chosen-sprite.png',
+ ], {
+ dot: true
+ }).pipe(gulp.dest('dist/styles'))
+ .pipe($.size({title: 'copy'}));
+});
+
// Clean Output Directory
-gulp.task('clean', del.bind(null, ['.tmp', 'dist']));
+gulp.task('clean', del.bind(null, ['dist']));
// Watch Files For Changes & Reload
-gulp.task('serve', ['styles'], function () {
+gulp.task('serve', function () {
browserSync({
notify: false,
- // Customize the BrowserSync console logging prefix
logPrefix: 'QS',
- // Run as an https by uncommenting 'https: true'
- // Note: this uses an unsigned certificate which on first access
- // will present a certificate warning in the browser.
- // https: true,
server: {
- baseDir: ['.tmp', 'app'],
+ baseDir: 'app',
routes: {
"/bower_components": "./bower_components"
}
}
});
gulp.watch(['app/**/*.html'], reload);
- gulp.watch(['app/styles/**/*.css'], ['styles', reload]);
+ gulp.watch(['app/styles/**/*.css'], [reload]);
gulp.watch(['app/scripts/**/*.js'], ['jshint']);
gulp.watch(['app/images/**/*'], reload);
});
@@ -138,15 +101,11 @@ gulp.task('serve:dist', ['default'], function () {
browserSync({
notify: false,
logPrefix: 'QS',
- // Run as an https by uncommenting 'https: true'
- // Note: this uses an unsigned certificate which on first access
- // will present a certificate warning in the browser.
- // https: true,
server: 'dist'
});
});
// Build Production Files, the Default Task
gulp.task('default', ['clean'], function (cb) {
- runSequence('styles', ['jshint', 'html', 'images', 'copy'], cb);
+ runSequence(['jshint', 'html', 'images', 'copy', 'assets'], cb);
});
View
@@ -1,29 +1,19 @@
{
"devDependencies": {
- "apache-server-configs": "^2.7.1",
"browser-sync": "^1.3.0",
"del": "^0.1.2",
"gulp": "^3.8.5",
- "gulp-autoprefixer": "^1.0.0",
"gulp-cache": "^0.2.2",
- "gulp-changed": "^1.0.0",
"gulp-csso": "^0.2.9",
- "gulp-flatten": "^0.0.2",
"gulp-if": "^1.2.1",
"gulp-imagemin": "^1.0.0",
"gulp-jshint": "^1.6.3",
"gulp-load-plugins": "^0.6.0",
"gulp-minify-html": "^0.1.5",
- "gulp-replace": "^0.4.0",
- "gulp-ruby-sass": "^0.7.1",
"gulp-size": "^1.0.0",
"gulp-uglify": "^1.0.1",
- "gulp-uncss": "^0.4.5",
"gulp-useref": "^1.0.1",
"jshint-stylish": "^0.4.0",
- "opn": "^1.0.0",
- "psi": "^0.1.2",
- "require-dir": "^0.1.0",
"run-sequence": "^0.3.6"
},
"engines": {

0 comments on commit d17c095

Please sign in to comment.