Skip to content

Commit

Permalink
AMD, CommonJS module are supported.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Ceyer committed Mar 3, 2017
1 parent 417c176 commit 856c598
Show file tree
Hide file tree
Showing 29 changed files with 5,418 additions and 923 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
@@ -0,0 +1,6 @@
[*]
indent_style = space
end_of_line = lf

[*.js]
indent_size = 4
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,3 +1,3 @@
node_modules/
.dist/
.idea/
*.DS_Store
61 changes: 61 additions & 0 deletions .jshintrc
@@ -0,0 +1,61 @@
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 10, // Maximum error before stopping.

// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
"node" : true,
"rhino" : false,
"couch" : false,
"wsh" : true,
"jquery" : true,
"prototypejs" : false,
"mootools" : false,
"dojo" : false,
"predef" : [
],

// Development.
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
"devel" : true, // Allow developments statements e.g. `console.log();`.

// ECMAScript 5.
"es5" : true, // Allow ECMAScript 5 syntax.
"strict" : false, // Require `use strict` pragma in every file.
"globalstrict" : false, // Allow global "use strict" (also enables 'strict').

// The Good Parts.
"asi" : true, // Tolerate Automatic Semicolon Insertion (no semicolons).
"laxbreak" : true, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
"bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.).
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
"curly" : true, // Require {} for every new block or scope.
"eqeqeq" : true, // Require triple equals i.e. `===`.
"eqnull" : false, // Tolerate use of `== null`.
"evil" : false, // Tolerate use of `eval`.
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
"forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"latedef" : true, // Prohipit variable use before definition.
"loopfunc" : false, // Allow functions to be defined within loops.
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"regexp" : true, // Prohibit `.` and `[^...]` in regular expressions.
"regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`.
"scripturl" : true, // Tolerate script-targeted URLs.
"shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
"supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
"undef" : true, // Require all non-global variables be declared before they are used.

// Personal styling preferences.
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
"noempty" : true, // Prohibit use of empty blocks.
"nonew" : true, // Prohibit use of constructors for side-effects.
"nomen" : true, // Prohibit use of initial or trailing underbars in names.
"onevar" : false, // Allow only one `var` statement per function.
"plusplus" : false, // Prohibit use of `++` & `--`.
"sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
"trailing" : true, // Prohibit trailing whitespaces.
"white" : false, // Check against strict whitespace and indentation rules.
"indent" : 4 // Specify indentation spacing
}
141 changes: 97 additions & 44 deletions Gruntfile.js
Expand Up @@ -5,10 +5,10 @@ module.exports = function (grunt) {
// Metadata
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= 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 <%= props.license %> */\n',
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= props.license %> */\n',
// Task configuration
uglify: {
options: {
Expand All @@ -20,59 +20,111 @@ module.exports = function (grunt) {
},
dist: {
files: {
'dist/pignose.calendar.min.js': ['src/js/**.js']
'dist/js/pignose.calendar.min.js': [
'dist/js/pignose.calendar.js',
],
'dist/js/pignose.calendar.full.min.js': [
'dist/js/pignose.calendar.full.js'
]
}
},
},
cssUrlRewrite: {
dist: {
src: 'src/css/**.css',
dest: '.dist/css/pignose.calendar.css',
options: {
skipExternal: true,
rewriteUrl: function(url, options, dataURI) {
var path = url.replace('src/', '');
return path;
}
}
}
cssUrlRewrite: {
dist: {
src: 'src/css/**.css',
dest: 'dist/css/pignose.calendar.css',
options: {
skipExternal: true,
rewriteUrl: function(url, options, dataURI) {
var path = url.replace('src/', '../');
return path;
}
}
}
},
cssmin: {
options: {
banner: '//================================================================================\n' +
'// [<%= pkg.name %>]\n' +
'// version: <%= pkg.version %>\n' +
'// update: <%= grunt.template.today("yyyy.mm.dd") %>\n' +
'//================================================================================\n\n'
},
dist: {
files: {
'dist/pignose.calendar.min.css': ['.dist/css/**.css']
options: {
banner: '//================================================================================\n' +
'// [<%= pkg.name %>]\n' +
'// version: <%= pkg.version %>\n' +
'// update: <%= grunt.template.today("yyyy.mm.dd") %>\n' +
'//================================================================================\n\n'
},
dist: {
files: {
'dist/css/pignose.calendar.min.css': [
'dist/css/pignose.calendar.css'
]
}
}
}
},
jshint: {
files: ['Gruntfile.js', 'src/**.js'],
options: {
// options here to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true,
document: true
files: ['Gruntfile.js', 'src/**.js'],
options: {
jshintrc: true
}
}
},
copy: {
main: {
files: [{expand: true, cwd: 'src', src: 'fonts/*', dest: 'dist/'}]
}
copy: {
main: {
files: [
{
expand: true,
cwd: 'src',
src: 'fonts/*',
dest: 'dist/'
}
]
}
},
csslint: {
dist: ['src/**.css']
dist: ['src/**.css']
},
qunit: {
files: ['test/**/*.html']
files: ['tests/**/*.html']
},
requirejs: {
dist: {
options: {
name: 'plugin',
baseUrl: 'src/js/',
optimize: 'none',
include: [
'almond'
],
paths: {
plugin: 'plugins/jquery.plugin',
almond: '../../node_modules/almond/almond',
jquery: 'shim/jquery.shim',
moment: 'shim/moment.shim'
},
out: 'dist/js/pignose.calendar.js',
wrap: {
startFile: 'src/js/wrapper/start.wrapper.js',
endFile: 'src/js/wrapper/end.wrapper.js'
}
}
},
full: {
options: {
name: 'plugin',
baseUrl: 'src/js/',
optimize: 'none',
include: [
'almond',
],
paths: {
plugin: 'plugins/jquery.plugin',
almond: '../../node_modules/almond/almond',
jquery: '../../node_modules/jquery/dist/jquery.min',
moment: '../../node_modules/moment/min/moment.min'
},
out: 'dist/js/pignose.calendar.full.js',
wrap: {
startFile: 'src/js/wrapper/start.wrapper.js',
endFile: 'src/js/wrapper/end.wrapper.js'
}
}
}
},
watch: {
gruntfile: {
Expand All @@ -93,8 +145,9 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-css-url-rewrite');
grunt.loadNpmTasks('grunt-contrib-requirejs');

// Default task
grunt.registerTask('default', ['jshint', 'csslint', 'copy', 'cssUrlRewrite', 'cssmin', 'uglify']);
grunt.registerTask('default', ['jshint', 'csslint', 'copy', 'cssUrlRewrite', 'cssmin', 'requirejs:dist', 'requirejs:full', 'uglify']);
grunt.registerTask('test', ['jshint', 'csslint']);
};
5 changes: 2 additions & 3 deletions bower.json
Expand Up @@ -2,11 +2,10 @@
"name": "pg-calendar",
"description": "Beautiful and eidetic jQuery date picker plguin.",
"main": [
"dist/pignose.calendar.min.js",
"dist/pignose.calendar.min.css"
"dist/pignose.calendar.min.js"
],
"authors": [
"Kenneth Ceyer <kennethan@nhpcw.com> (http://www.pigno.se)"
"PIGNOSE <kennethan@nhpcw.com> (http://www.pigno.se)"
],
"license": "MIT",
"keywords": [
Expand Down

0 comments on commit 856c598

Please sign in to comment.