Skip to content

Commit 911b3b7

Browse files
committed
add minified with grunt task
1 parent 7046b9f commit 911b3b7

File tree

14 files changed

+194
-11
lines changed

14 files changed

+194
-11
lines changed

Gruntfile.js

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
module.exports = function(grunt) {
2+
var lang = grunt.option('lang') || 'en';
3+
4+
grunt.initConfig({
5+
pkg: grunt.file.readJSON('package.json'),
6+
7+
banner:
8+
'/*!\n'+
9+
' * jQuery QueryBuilder <%= pkg.version %>\n'+
10+
' * Copyright <%= grunt.template.today("yyyy") %> Damien "Mistic" Sorel (http://www.strangeplanet.fr)\n'+
11+
' * Licensed under MIT (http://opensource.org/licenses/MIT)\n'+
12+
' */',
13+
14+
// compress js
15+
uglify: {
16+
options: {
17+
banner: '<%= banner %>\n'
18+
},
19+
nolang: {
20+
files: {
21+
'dist/query-builder.min.js': ['src/query-builder.js']
22+
}
23+
},
24+
lang: {
25+
files: {
26+
'dist/query-builder.min.js': [
27+
'src/query-builder.js',
28+
'src/i18n/'+ lang +'.js'
29+
]
30+
}
31+
}
32+
},
33+
34+
// copy i18n
35+
copy: {
36+
i18n: {
37+
files: [{
38+
expand: true,
39+
flatten: true,
40+
src: ['src/i18n/*.js'],
41+
dest: 'dist/i18n'
42+
}]
43+
}
44+
},
45+
46+
// compress css
47+
cssmin: {
48+
options: {
49+
banner: '<%= banner %>',
50+
keepSpecialComments: 0
51+
},
52+
dist: {
53+
files: {
54+
'dist/query-builder.min.css': [
55+
'src/query-builder.css'
56+
]
57+
}
58+
}
59+
}
60+
});
61+
62+
grunt.loadNpmTasks('grunt-contrib-uglify');
63+
grunt.loadNpmTasks('grunt-contrib-copy');
64+
grunt.loadNpmTasks('grunt-contrib-cssmin');
65+
66+
grunt.registerTask('default', [
67+
'uglify:nolang',
68+
'copy',
69+
'cssmin'
70+
]);
71+
72+
grunt.registerTask('onelang', [
73+
'uglify:lang',
74+
'cssmin'
75+
]);
76+
};

bower.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
}],
88
"description": "jQuery plugin for user friendly query/filter creator",
99
"main": [
10-
"./query-builder.js",
11-
"./query-builder.css"
10+
"dist/query-builder.min.js",
11+
"dist/query-builder.min.css"
1212
],
1313
"dependencies" : {
14-
"bootstrap": "3.x.x"
14+
"jquery": ">= 1.9.0",
15+
"bootstrap": "3.x.x",
16+
"momentjs": "2.x.x"
1517
},
1618
"keywords": [
1719
"jquery",
File renamed without changes.
File renamed without changes.
File renamed without changes.

dist/query-builder.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/query-builder.min.js

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

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77
},
88
"description": "jQuery plugin for user friendly query/filter creator",
99
"main": [
10-
"./query-builder.js",
11-
"./query-builder.css"
10+
"dist/query-builder.min.js",
11+
"dist/query-builder.min.css"
1212
],
13-
"dependencies" : {
14-
"bootstrap": "3.x.x"
13+
"devDependencies": {
14+
"grunt": "~0.4.5",
15+
"grunt-contrib-uglify": "~0.4.0",
16+
"grunt-contrib-cssmin": "~0.9.0",
17+
"grunt-contrib-copy": "~0.5.0"
1518
},
1619
"keywords": [
1720
"jquery",

src/i18n/en.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
QueryBuilder.setDefaults({ lang: {
2+
"add_rule": "Add rule",
3+
"add_group": "Add group",
4+
"delete_rule": "Delete",
5+
"delete_group": "Delete",
6+
7+
"and_condition": "AND",
8+
"or_condition": "OR",
9+
10+
"filter_select_placeholder": "------",
11+
12+
"operator_equal": "equal",
13+
"operator_not_equal": "not equal",
14+
"operator_in": "in",
15+
"operator_not_in": "not in",
16+
"operator_less": "less",
17+
"operator_less_or_equal": "less or equal",
18+
"operator_greater": "greater",
19+
"operator_greater_or_equal": "greater or equal",
20+
"operator_begins_with": "begins with",
21+
"operator_not_begins_with": "doesn't begin with",
22+
"operator_contains": "contains",
23+
"operator_not_contains": "doesn't contain",
24+
"operator_ends_with": "ends with",
25+
"operator_not_ends_with": "doesn't end with",
26+
"operator_is_empty": "is empty",
27+
"operator_is_not_empty": "is not empty",
28+
"operator_is_null": "is null",
29+
"operator_is_not_null": "is not null"
30+
}});

src/i18n/fr.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
QueryBuilder.setDefaults({ lang: {
2+
"add_rule": "Ajouter une règle",
3+
"add_group": "Ajouter un groupe",
4+
"delete_rule": "Supprimer",
5+
"delete_group": "Supprimer",
6+
7+
"and_condition": "ET",
8+
"or_condition": "OU",
9+
10+
"filter_select_placeholder": "------",
11+
12+
"operator_equal": "égal",
13+
"operator_not_equal": "non égal",
14+
"operator_in": "dans",
15+
"operator_not_in": "pas dans",
16+
"operator_less": "inférieur",
17+
"operator_less_or_equal": "inférieur ou égal",
18+
"operator_greater": "supérieur",
19+
"operator_greater_or_equal": "supérieur ou égal",
20+
"operator_begins_with": "commence par",
21+
"operator_not_begins_with": "ne commence pas par",
22+
"operator_contains": "contient",
23+
"operator_not_contains": "ne contient pas",
24+
"operator_ends_with": "finit par",
25+
"operator_not_ends_with": "ne finit pas par",
26+
"operator_is_empty": "est vide",
27+
"operator_is_not_empty": "n'est pas vide",
28+
"operator_is_null": "est nul",
29+
"operator_is_not_null": "n'est pas nul"
30+
}});

src/i18n/ro.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
QueryBuilder.setDefaults({ lang: {
2+
"add_rule": "Adaugă regulă",
3+
"add_group": "Adaugă grup",
4+
"delete_rule": "Şterge",
5+
"delete_group": "Şterge",
6+
7+
"and_condition": "ŞI",
8+
"or_condition": "SAU",
9+
10+
"filter_select_placeholder": "------",
11+
12+
"operator_equal": "egal",
13+
"operator_not_equal": "diferit",
14+
"operator_in": "în",
15+
"operator_not_in": "nu în",
16+
"operator_less": "mai puţin",
17+
"operator_less_or_equal": "mai puţin sau egal",
18+
"operator_greater": "mai mare",
19+
"operator_greater_or_equal": "mai mare sau egal",
20+
"operator_begins_with": "începe cu",
21+
"operator_not_begins_with": "nu începe cu",
22+
"operator_contains": "conţine",
23+
"operator_not_contains": "nu conţine",
24+
"operator_ends_with": "se termină cu",
25+
"operator_not_ends_with": "nu se termină cu",
26+
"operator_is_empty": "este gol",
27+
"operator_is_not_empty": "nu este gol",
28+
"operator_is_null": "e nul",
29+
"operator_is_not_null": "nu e nul"
30+
}});

query-builder.css renamed to src/query-builder.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* QueryBuilder v1.0.0-SNAPSHOT
2+
* jQuery QueryBuilder
33
* Copyright 2014 Damien "Mistic" Sorel (http://www.strangeplanet.fr)
44
* Licensed under MIT (http://opensource.org/licenses/MIT)
55
*/

query-builder.js renamed to src/query-builder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* QueryBuilder v1.0.0-SNAPSHOT
2+
* jQuery QueryBuilder
33
* Copyright 2014 Damien "Mistic" Sorel (http://www.strangeplanet.fr)
44
* Licensed under MIT (http://opensource.org/licenses/MIT)
55
*/

tests/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="utf-8">
55

66
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">
7-
<link rel="stylesheet" href="../query-builder.css">
7+
<link rel="stylesheet" href="../dist/query-builder.min.css">
88
</head>
99

1010
<body>
@@ -27,7 +27,7 @@ <h3>Output</h3>
2727
</div>
2828

2929
<script src="../bower_components/jquery/dist/jquery.min.js"></script>
30-
<script src="../query-builder.js"></script>
30+
<script src="../dist/query-builder.min.js"></script>
3131

3232
<script>
3333
// define filters

0 commit comments

Comments
 (0)