Remove `.es6` suffix for file name. Remove old grunt file.

Only include jQuery on pages which request it.
Use SRI hash for CDN version of jQuery.
pull/111/head
Glen Cheney 8 years ago
parent 98c916d3cd
commit 150de2024f

@ -1,163 +0,0 @@
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
var banner = [
'/*!',
' * Shuffle.js by @Vestride',
' * Categorize, sort, and filter a responsive grid of items.',
' * Dependencies: jQuery 1.9+, Modernizr 2.6.2+',
' * @license MIT license',
' * @version <%= pkg.version %>',
' */\n'
].join('\n');
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
shell: {
serve: {
options: {
stdout: true,
stderr: true,
failOnError: true
},
command: 'jekyll serve --watch --config _config.yml,_config_dev.yml'
}
},
watch: {
livereload: {
options: {
livereload: true,
interupt: true
},
files: [
'_site/**/*.{html,css,js,png,jpg,jpeg,gif,webp,svg,json}'
]
},
css: {
files: '_scss/*.scss',
tasks: ['compile-css'],
},
src: {
files: 'src/*.js',
tasks: ['concat', 'test']
},
test: {
files: 'test/specs.js',
tasks: ['test']
}
},
sass: {
main: {
options: {
style: 'expanded'
},
files: {
'temp/gallery.css': '_scss/gallery.scss',
'temp/shuffle-styles.css': '_scss/shuffle-styles.scss',
'temp/style.css': '_scss/style.scss'
}
}
},
autoprefixer: {
options: {
browsers: ['> 1%', 'last 2 versions']
},
main: {
expand: true,
flatten: true,
src: 'temp/*.css',
dest: 'css/'
}
},
concat: {
options: {
banner: banner
},
main: {
src: ['src/intro.js', 'src/shuffle.js', 'src/outro.js'],
dest: 'dist/jquery.shuffle.js'
},
modernizr: {
src: ['src/modernizr.custom.min.js', 'src/intro.js', 'src/shuffle.js', 'src/outro.js'],
dest: 'dist/jquery.shuffle.modernizr.js'
}
},
uglify: {
options: {
preserveComments: false,
banner: banner,
report: 'min',
mangle: true,
compress: {}
},
main: {
src: 'dist/jquery.shuffle.js',
dest: 'dist/jquery.shuffle.min.js'
},
modernizr: {
src: 'dist/jquery.shuffle.modernizr.js',
dest: 'dist/jquery.shuffle.modernizr.min.js'
}
},
jasmine: {
main: {
src: 'dist/jquery.shuffle.js',
options: {
specs: 'test/specs.js',
vendor: [
'dist/modernizr.custom.min.js',
'http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js',
'bower_components/jasmine-jquery/lib/jasmine-jquery.js'
],
outfile: 'test/_SpecRunner.html',
keepRunner: true
}
}
}
});
grunt.registerTask('compile-css', 'compile and prefix css', function() {
grunt.task.run('sass:main');
grunt.task.run('autoprefixer:main');
});
// Use Jekyll to watch and rebuild files.
grunt.registerTask('serve', function() {
grunt.task.run(['build', 'shell:serve']);
});
grunt.registerTask('build', function() {
// Copy over custom modernizr build.
grunt.file.copy('src/modernizr.custom.min.js', 'dist/modernizr.custom.min.js');
// Run concat and minfication.
grunt.task.run([
'concat:main',
'concat:modernizr',
'uglify:main',
'uglify:modernizr',
'test'
]);
});
grunt.registerTask('test', function() {
grunt.task.run('jasmine:main');
});
// Default task(s).
grunt.registerTask('default', ['serve']);
};

@ -1,5 +1,5 @@
{% if page.jquery != false %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
{% if page.jquery %}
<script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha384-I6F5OKECLVtK/BL+8iSLDEHowSAfUo76ZL9+kGAgTRdiByINKJaqTPH/QVNS1VDb" crossorigin="anonymous"></script>
{% endif %}
{% if page.shuffle != false %}

@ -4,6 +4,7 @@ title: Animate In Demo
description: When elements enter the viewport, they transition in from zero opacity and from the bottom.
image: /demos/animated.jpg
prism: true
jquery: true
extraJS: [ "viewport.js", "demos/animate-in.js" ]
---
<div class="container">

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -3,7 +3,7 @@ const path = require('path');
module.exports = {
name: 'build',
devtool: 'source-map',
entry: './src/shuffle.es6.js',
entry: './src/shuffle.js',
output: {
filename: 'shuffle.js',
path: './dist',

@ -4,7 +4,7 @@ const webpack = require('webpack');
module.exports = {
name: 'minified',
devtool: 'source-map',
entry: './src/shuffle.es6.js',
entry: './src/shuffle.js',
output: {
filename: 'shuffle.min.js',
path: './dist',

Loading…
Cancel
Save