forked from opensourcepos/opensourcepos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Gruntfile.js for concat+uglification of javascript
Enable debug=true cookie for full source inclusion in header.php Add template in header.php to inject generated javascript files
- Loading branch information
Showing
9 changed files
with
15,523 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
node_modules | ||
bower_components | ||
application/config/email.php | ||
application/config/database.php | ||
*.patch | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
module.exports = function(grunt) { | ||
|
||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
concat: { | ||
options: { | ||
separator: ';' | ||
}, | ||
dist: { | ||
src: ['js/jquery*', 'js/*.js'], | ||
dest: 'dist/<%= pkg.name %>.js' | ||
} | ||
}, | ||
uglify: { | ||
options: { | ||
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n' | ||
}, | ||
dist: { | ||
files: { | ||
'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>'] | ||
} | ||
} | ||
}, | ||
jshint: { | ||
files: ['Gruntfile.js', 'js/*.js'], | ||
options: { | ||
// options here to override JSHint defaults | ||
globals: { | ||
jQuery: true, | ||
console: true, | ||
module: true, | ||
document: true | ||
} | ||
} | ||
}, | ||
tags: { | ||
js : { | ||
options: { | ||
scriptTemplate: '<script type="text/javascript" src="{{ path }}" language="javascript"></script>', | ||
openTag: '<!-- start js template tags -->', | ||
closeTag: '<!-- end js template tags -->', | ||
absolutePath: true | ||
}, | ||
src: [ | ||
'js/*.js', | ||
], | ||
dest: 'application/views/partial/header.php' | ||
}, | ||
minjs : { | ||
options: { | ||
scriptTemplate: '<script type="text/javascript" src="{{ path }}" language="javascript"></script>', | ||
openTag: '<!-- start minjs template tags -->', | ||
closeTag: '<!-- end minjs template tags -->', | ||
absolutePath: true | ||
}, | ||
src: [ | ||
'dist/*min.js', | ||
], | ||
dest: 'application/views/partial/header.php' | ||
} | ||
}, | ||
watch: { | ||
files: ['<%= jshint.files %>'], | ||
tasks: ['jshint'] | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-contrib-concat'); | ||
grunt.loadNpmTasks('grunt-script-link-tags'); | ||
|
||
grunt.registerTask('default', ['tags:js', 'tags:css', 'concat', 'uglify', 'tags:minjs']); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.