Permalink
Browse files

Moved to Grunt

- Online build tool
- Deeper modularity
  • Loading branch information...
dimsemenov committed Mar 4, 2013
1 parent cd0caa7 commit f5dff3dc7fca0348d0ff547764828aa8bc00674d
Showing with 24,953 additions and 1,357 deletions.
  1. +20 −0 .gitignore
  2. +202 −0 Gruntfile.js
  3. +46 −4 README.md
  4. +0 −733 jquery.magnific-popup.js
  5. +12 −0 libs/jquery-loader.js
  6. +9,555 −0 libs/jquery/jquery.js
  7. +244 −0 libs/qunit/qunit.css
  8. +2,152 −0 libs/qunit/qunit.js
  9. +27 −0 magnific-popup.jquery.json
  10. +0 −71 modules/jquery.mfp.ajax.js
  11. +0 −96 modules/jquery.mfp.back-browser-button.js
  12. +0 −216 modules/jquery.mfp.gallery.js
  13. +0 −113 modules/jquery.mfp.image.js
  14. +23 −0 package.json
  15. +89 −79 magnific-popup.css → src/css/main.scss
  16. +74 −0 src/js/ajax.js
  17. +655 −0 src/js/core.js
  18. +191 −0 src/js/gallery.js
  19. +30 −45 modules/jquery.mfp.iframe.js → src/js/iframe.js
  20. +92 −0 src/js/image.js
  21. +35 −0 src/js/inline.js
  22. +32 −0 test/.jshintrc
  23. +27 −0 test/magnific-popup.html
  24. +62 −0 test/magnific-popup_test.js
  25. +7 −0 website/_config.yml
  26. +50 −0 website/_includes/analytics.html
  27. +124 −0 website/_includes/build-tool.html
  28. +431 −0 website/_includes/examples.html
  29. +61 −0 website/_includes/logo.html
  30. +44 −0 website/_layouts/default.html
  31. +299 −0 website/documentation.md
  32. +115 −0 website/index.html
  33. +218 −0 website/site-assets/img/l.svg
  34. BIN website/site-assets/img/p1/1.jpg
  35. BIN website/site-assets/img/p1/2.jpg
  36. BIN website/site-assets/img/p1/3.jpg
  37. BIN website/site-assets/img/p1/4.jpg
  38. BIN website/site-assets/img/p1/5.jpg
  39. BIN website/site-assets/img/p1/6.jpg
  40. BIN website/site-assets/img/p1/7.jpg
  41. BIN website/site-assets/img/p1/tmb/1.jpg
  42. BIN website/site-assets/img/p1/tmb/2.jpg
  43. BIN website/site-assets/img/p1/tmb/3.jpg
  44. BIN website/site-assets/img/p1/tmb/4.jpg
  45. BIN website/site-assets/img/p1/tmb/5.jpg
  46. BIN website/site-assets/img/p1/tmb/6.jpg
  47. BIN website/site-assets/img/p1/tmb/7.jpg
  48. +382 −0 website/site-assets/site.css
  49. +29 −0 website/site-assets/test-ajax-2.html
  50. +9 −0 website/site-assets/test-ajax.html
  51. +9,597 −0 website/third-party-libs/jquery.js
  52. +4 −0 website/third-party-libs/jquery.min.js
  53. +13 −0 website/third-party-libs/uglify.js
  54. +2 −0 website/third-party-libs/zepto.js
View
@@ -0,0 +1,20 @@
Gemfile.lock
test/dest
*.gem
pkg/
*.swp
*~
_site/
.bundle/
.DS_Store
bbin/
sftp-config*
_site
.htaccess
private-*
__article/
node_modules
dist/
_production
all.min.css
.sublime-*
View
@@ -0,0 +1,202 @@
/**
*
* Run 'grunt' to generate JS and CSS in folder 'dist' and site in folder '_site'
*
* Run `grunt production` to generate production site in folder '_production_site'
*
* Run 'grunt watch' to automatically regenerate '_site' when you change files in 'src' or in 'website'
*
*/
module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('magnific-popup.jquery.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
// Task configuration.
clean: {
files: ['dist']
},
sass: {
dist: {
files: {
'dist/magnific-popup.css': 'src/css/main.scss'
}
}
},
jshint: {
all: ['Gruntfile.js', 'src/js/*.js'],
options: {
"curly": false,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"unused": true,
"boss": true,
"eqnull": true,
"browser": true,
"predef": [
"jQuery",
"define",
"module",
"console",
"mfp",
"$"
]
}
},
mfpbuild: {
all: {
src: [
'inline',
'ajax',
'image',
'iframe',
'gallery'
],
basePath: 'src/js/',
dest: 'dist/jquery.magnific-popup.js',
banner: '<%= banner %>'
}
},
jekyll: {
dev: {
src: 'website',
dest: '_site',
url: 'local'
},
production: {
src: 'website',
dest: '_production',
url: 'production'
}
},
copy: {
main: {
files: [
{src: ['dist/**'], dest: 'website/'}
]
},
dev: {
files: [
{src: ['dist/**'], dest: '_site/'}
]
}
},
uglify: {
my_target: {
files: {
'dist/jquery.magnific-popup.min.js': ['dist/jquery.magnific-popup.js']
}
}
},
watch: { // for development run 'grunt watch'
jekyll: {
files: ['website/**'],
tasks: ['jekyll:dev']
},
files: ['src/**'],
tasks: ['jshint', 'sass', 'mfpbuild', 'copy:dev']
},
cssmin: {
compress: {
files: {
"website/site-assets/all.min.css": ["website/site-assets/site.css", "website/dist/magnific-popup.css"]
}
}
}
});
// Makes Magnific Popup JS file.
// grunt mfpbuild --mfp-exclude=ajax,image
grunt.task.registerMultiTask('mfpbuild', 'Makes Magnific Popup JS file.', function() {
var files = this.data.src,
includes = grunt.option('mfp-exclude'),
basePath = this.data.basePath,
newContents = this.data.banner + ";(function($) {\n";
if(includes) {
includes = includes.split(/[\s,]+/); // 'a,b,c' => ['a','b','c']
var removeA = function (arr) {
var what, a = arguments, L = a.length, ax;
while (L > 1 && arr.length) {
what = a[--L];
while ((ax= arr.indexOf(what)) !== -1) {
arr.splice(ax, 1);
}
}
return arr;
};
includes.forEach(function( name ) {
if(name) {
grunt.log.writeln( 'removed "'+name +'"' );
files = removeA(files, name);
}
});
}
files.unshift('core');
grunt.log.writeln( 'Your build is made of:'+files );
files.forEach(function( name ) {
// Wrap each module with a pience of code to be able to exlude it, stolen for modernizr.com
newContents += "\n/*>>"+name+"*/\n";
newContents += grunt.file.read( basePath + name + '.js' ) + '\n';
newContents += "\n/*>>"+name+"*/\n";
});
newContents+= "})(window.jQuery || window.Zepto);";
grunt.file.write( this.data.dest, newContents );
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-jekyll');
grunt.loadNpmTasks('grunt-contrib-cssmin');
// Default task.
grunt.registerTask('default', ['jshint', 'sass', 'mfpbuild', 'uglify', 'copy', 'jekyll:dev']);
grunt.registerTask('production', ['jshint', 'sass', 'mfpbuild', 'uglify', 'copy', 'cssmin', 'jekyll:production']);
};
View
@@ -1,7 +1,49 @@
# Magnific Popup plugin for jQuery and Zepto.js.
# Magnific Popup
**Script is not finished** yet and currently is under active development.
Fast, light and responsive lightbox plugin. More info on [official site](http://dimsemenov.com/plugins/magnific-popup/).
Plugin is licensed under MIT license with a small restriction - You can not use it in public WordPress plugin (because I will create it =), but you can use it in, for example, themes
Project is under development, please wait until I finish it.
Read more about it on [http://dimsemenov.com/plugins/magnific-popup/](http://dimsemenov.com/plugins/magnific-popup/).
## Build
Copy repository
git clone https://github.com/dimsemenov/Magnific-Popup.git
Install grunt globally (if you haven't yet)
npm install -g grunt-cli
Go inside Magnific Popup folder and install Node dependencies
cd Magnific-Popup && npm install
Make sure you that you have grunt installed by testing:
grunt -version
Compile Magnific Popup
grunt
- Generated Magnific Popup JS and CSS files are in folder `dist`.
- Magnific Popup source files are in folder `src`.
- Website (examples & documentation) source is is folder `website`.
- Generated website is in folder `_site`.
## Documentation
_(Coming soon)_
## Examples
_(Coming soon)_
## Release History
_(Nothing yet)_
## License
Script is MIT licensed and free and will always be kept this way. But has a small restriction from me - Please do not create public WordPress plugin based on it, because I will create it.
Oops, something went wrong.

0 comments on commit f5dff3d

Please sign in to comment.