Skip to content

Commit

Permalink
update grunt tasks
Browse files Browse the repository at this point in the history
- updated watch tasks for use with the tests
- let uglify mangle
- more separation between jquery and proto
- more separation between main scripts and tests
  • Loading branch information
koenpunt committed Oct 29, 2016
1 parent 95c89d1 commit 6935764
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions Gruntfile.coffee
Expand Up @@ -36,21 +36,28 @@ This file is generated by `grunt build`, do not edit it by hand.
coffee:
options:
join: true
compile:
jquery:
files:
'public/chosen.jquery.js': ['coffee/lib/select-parser.coffee', 'coffee/lib/abstract-chosen.coffee', 'coffee/chosen.jquery.coffee']
proto:
files:
'public/chosen.proto.js': ['coffee/lib/select-parser.coffee', 'coffee/lib/abstract-chosen.coffee', 'coffee/chosen.proto.coffee']
test:
files:
'spec/public/jquery_specs.js': 'spec/jquery/*.spec.coffee'
'spec/public/proto_specs.js': 'spec/proto/*.spec.coffee'

uglify:
options:
mangle:
except: ['jQuery', 'AbstractChosen', 'Chosen', 'SelectParser']
banner: '<%= minified_comments %>'
minified_chosen_js:
jquery:
options:
mangle:
except: ['jQuery']
files:
'public/chosen.jquery.min.js': ['public/chosen.jquery.js']
proto:
files:
'public/chosen.proto.min.js': ['public/chosen.proto.js']

sass:
Expand All @@ -65,41 +72,46 @@ This file is generated by `grunt build`, do not edit it by hand.
processors: [
require('autoprefixer')(browsers: 'last 2 versions, IE 8')
]
dist:
main:
src: 'public/chosen.css'

cssmin:
minified_chosen_css:
options:
banner: '<%= minified_comments %>'
keepSpecialComments: 0
options:
banner: '<%= minified_comments %>'
keepSpecialComments: 0
main:
src: 'public/chosen.css'
dest: 'public/chosen.min.css'

watch:
scripts:
default:
files: ['coffee/**/*.coffee', 'sass/*.scss']
tasks: ['build']
tasks: ['build', 'jasmine']
test:
files: ['spec/**/*.coffee']
tasks: ['jasmine']

jasmine:
jquery:
src: [ 'public/chosen.jquery.js' ]
options:
vendor: [ 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js' ]
specs: 'spec/public/jquery_specs.js'
src: [ 'public/chosen.jquery.js' ]
proto:
src: [ 'public/chosen.proto.js' ]
options:
vendor: [
'https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js',
'public/docsupport/event.simulate.js'
]
specs: 'spec/public/proto_specs.js'
src: [ 'public/chosen.proto.js' ]

grunt.loadTasks 'tasks'

grunt.registerTask 'default', ['build']
grunt.registerTask 'build', ['coffee', 'sass', 'concat', 'uglify', 'postcss', 'cssmin', 'package-bower']
grunt.registerTask 'build', ['coffee:jquery', 'coffee:proto', 'sass', 'concat', 'uglify', 'postcss', 'cssmin', 'package-bower']
grunt.registerTask 'test', ['coffee', 'jasmine']
grunt.registerTask 'test:jquery', ['coffee:test', 'coffee:jquery', 'jasmine:jquery']
grunt.registerTask 'test:proto', ['coffee:test', 'coffee:proto', 'jasmine:proto']


0 comments on commit 6935764

Please sign in to comment.