Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit eb86c50

Browse files
committed
feat(build): add minified version to /dist
1 parent 5340e69 commit eb86c50

File tree

6 files changed

+67
-8
lines changed

6 files changed

+67
-8
lines changed

Gruntfile.js

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,18 @@ module.exports = function(grunt) {
88
grunt.loadNpmTasks('grunt-karma');
99
grunt.loadNpmTasks('grunt-conventional-changelog');
1010
grunt.loadNpmTasks('grunt-contrib-watch');
11+
grunt.loadNpmTasks('grunt-contrib-uglify');
12+
grunt.loadNpmTasks('grunt-contrib-cssmin');
1113

1214
grunt.initConfig({
15+
16+
pkg: grunt.file.readJSON('package.json'),
17+
1318
watch: {
1419
files: ['src/**/*'],
1520
tasks: ['build'],
1621
},
22+
1723
karma: {
1824
options: {
1925
configFile: 'karma.conf.js'
@@ -39,7 +45,8 @@ module.exports = function(grunt) {
3945
},
4046

4147
clean: {
42-
dist: ['.tmp/', 'dist/']
48+
dist: ['dist/'],
49+
tmp: ['.tmp/']
4350
},
4451

4552
ngTemplateCache: {
@@ -71,11 +78,41 @@ module.exports = function(grunt) {
7178
dest: 'dist/select.css'
7279
}]
7380
}
81+
},
82+
83+
uglify: {
84+
options: {
85+
banner: '/*!\n<%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %>\n<%= pkg.homepage %>\n*/\n',
86+
sourceMap: true
87+
},
88+
build: {
89+
files: {
90+
'dist/select.min.js': ['dist/select.js']
91+
}
92+
},
93+
compress: {
94+
global_defs: {
95+
"DEBUG": false
96+
},
97+
dead_code: true
98+
},
99+
},
100+
101+
cssmin: {
102+
minify: {
103+
options: {
104+
banner: '/*!\n<%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %>\n<%= pkg.homepage %>\n*/\n',
105+
},
106+
files: {
107+
'dist/select.min.css': ['src/select.css']
108+
}
109+
}
74110
}
111+
75112
});
76113

77114
grunt.registerTask('default', ['test']);
78-
grunt.registerTask('build', ['clean', 'ngTemplateCache', 'concat', 'copy']);
115+
grunt.registerTask('build', ['clean', 'ngTemplateCache', 'concat', 'copy', 'uglify:build', 'cssmin', 'clean:tmp']);
79116
grunt.registerTask('test', ['build', 'karma:once']);
80117
grunt.registerTask('test:watch', ['build', 'karma:watch']);
81118
grunt.registerTask('test:travis', ['build', 'karma:travis']);

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ Check the [examples](https://github.com/angular-ui/ui-select/blob/master/example
2525

2626
- `bower install angular-ui-select`
2727
- Inside your HTML add
28-
- select.js: `<script src="bower_components/angular-ui-select/dist/select.js"></script>`
29-
- select.css: `<link rel="stylesheet" href="bower_components/angular-ui-select/dist/select.css">`
28+
- select.js: `<script src="bower_components/angular-ui-select/dist/select.min.js"></script>`
29+
- select.css: `<link rel="stylesheet" href="bower_components/angular-ui-select/dist/select.min.css">`
3030

3131
### Bootstrap theme
3232

dist/select.min.css

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/select.min.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)