Skip to content

Commit

Permalink
add minified with grunt task
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Jun 4, 2014
1 parent 7046b9f commit 911b3b7
Show file tree
Hide file tree
Showing 14 changed files with 194 additions and 11 deletions.
76 changes: 76 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
module.exports = function(grunt) {
var lang = grunt.option('lang') || 'en';

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

banner:
'/*!\n'+
' * jQuery QueryBuilder <%= pkg.version %>\n'+
' * Copyright <%= grunt.template.today("yyyy") %> Damien "Mistic" Sorel (http://www.strangeplanet.fr)\n'+
' * Licensed under MIT (http://opensource.org/licenses/MIT)\n'+
' */',

// compress js
uglify: {
options: {
banner: '<%= banner %>\n'
},
nolang: {
files: {
'dist/query-builder.min.js': ['src/query-builder.js']
}
},
lang: {
files: {
'dist/query-builder.min.js': [
'src/query-builder.js',
'src/i18n/'+ lang +'.js'
]
}
}
},

// copy i18n
copy: {
i18n: {
files: [{
expand: true,
flatten: true,
src: ['src/i18n/*.js'],
dest: 'dist/i18n'
}]
}
},

// compress css
cssmin: {
options: {
banner: '<%= banner %>',
keepSpecialComments: 0
},
dist: {
files: {
'dist/query-builder.min.css': [
'src/query-builder.css'
]
}
}
}
});

grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');

grunt.registerTask('default', [
'uglify:nolang',
'copy',
'cssmin'
]);

grunt.registerTask('onelang', [
'uglify:lang',
'cssmin'
]);
};
8 changes: 5 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
}],
"description": "jQuery plugin for user friendly query/filter creator",
"main": [
"./query-builder.js",
"./query-builder.css"
"dist/query-builder.min.js",
"dist/query-builder.min.css"
],
"dependencies" : {
"bootstrap": "3.x.x"
"jquery": ">= 1.9.0",
"bootstrap": "3.x.x",
"momentjs": "2.x.x"
},
"keywords": [
"jquery",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions dist/query-builder.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions dist/query-builder.min.js

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
},
"description": "jQuery plugin for user friendly query/filter creator",
"main": [
"./query-builder.js",
"./query-builder.css"
"dist/query-builder.min.js",
"dist/query-builder.min.css"
],
"dependencies" : {
"bootstrap": "3.x.x"
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-contrib-copy": "~0.5.0"
},
"keywords": [
"jquery",
Expand Down
30 changes: 30 additions & 0 deletions src/i18n/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
QueryBuilder.setDefaults({ lang: {
"add_rule": "Add rule",
"add_group": "Add group",
"delete_rule": "Delete",
"delete_group": "Delete",

"and_condition": "AND",
"or_condition": "OR",

"filter_select_placeholder": "------",

"operator_equal": "equal",
"operator_not_equal": "not equal",
"operator_in": "in",
"operator_not_in": "not in",
"operator_less": "less",
"operator_less_or_equal": "less or equal",
"operator_greater": "greater",
"operator_greater_or_equal": "greater or equal",
"operator_begins_with": "begins with",
"operator_not_begins_with": "doesn't begin with",
"operator_contains": "contains",
"operator_not_contains": "doesn't contain",
"operator_ends_with": "ends with",
"operator_not_ends_with": "doesn't end with",
"operator_is_empty": "is empty",
"operator_is_not_empty": "is not empty",
"operator_is_null": "is null",
"operator_is_not_null": "is not null"
}});
30 changes: 30 additions & 0 deletions src/i18n/fr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
QueryBuilder.setDefaults({ lang: {
"add_rule": "Ajouter une règle",
"add_group": "Ajouter un groupe",
"delete_rule": "Supprimer",
"delete_group": "Supprimer",

"and_condition": "ET",
"or_condition": "OU",

"filter_select_placeholder": "------",

"operator_equal": "égal",
"operator_not_equal": "non égal",
"operator_in": "dans",
"operator_not_in": "pas dans",
"operator_less": "inférieur",
"operator_less_or_equal": "inférieur ou égal",
"operator_greater": "supérieur",
"operator_greater_or_equal": "supérieur ou égal",
"operator_begins_with": "commence par",
"operator_not_begins_with": "ne commence pas par",
"operator_contains": "contient",
"operator_not_contains": "ne contient pas",
"operator_ends_with": "finit par",
"operator_not_ends_with": "ne finit pas par",
"operator_is_empty": "est vide",
"operator_is_not_empty": "n'est pas vide",
"operator_is_null": "est nul",
"operator_is_not_null": "n'est pas nul"
}});
30 changes: 30 additions & 0 deletions src/i18n/ro.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
QueryBuilder.setDefaults({ lang: {
"add_rule": "Adaugă regulă",
"add_group": "Adaugă grup",
"delete_rule": "Şterge",
"delete_group": "Şterge",

"and_condition": "ŞI",
"or_condition": "SAU",

"filter_select_placeholder": "------",

"operator_equal": "egal",
"operator_not_equal": "diferit",
"operator_in": "în",
"operator_not_in": "nu în",
"operator_less": "mai puţin",
"operator_less_or_equal": "mai puţin sau egal",
"operator_greater": "mai mare",
"operator_greater_or_equal": "mai mare sau egal",
"operator_begins_with": "începe cu",
"operator_not_begins_with": "nu începe cu",
"operator_contains": "conţine",
"operator_not_contains": "nu conţine",
"operator_ends_with": "se termină cu",
"operator_not_ends_with": "nu se termină cu",
"operator_is_empty": "este gol",
"operator_is_not_empty": "nu este gol",
"operator_is_null": "e nul",
"operator_is_not_null": "nu e nul"
}});
2 changes: 1 addition & 1 deletion query-builder.css → src/query-builder.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* QueryBuilder v1.0.0-SNAPSHOT
* jQuery QueryBuilder
* Copyright 2014 Damien "Mistic" Sorel (http://www.strangeplanet.fr)
* Licensed under MIT (http://opensource.org/licenses/MIT)
*/
Expand Down
2 changes: 1 addition & 1 deletion query-builder.js → src/query-builder.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* QueryBuilder v1.0.0-SNAPSHOT
* jQuery QueryBuilder
* Copyright 2014 Damien "Mistic" Sorel (http://www.strangeplanet.fr)
* Licensed under MIT (http://opensource.org/licenses/MIT)
*/
Expand Down
4 changes: 2 additions & 2 deletions tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">

<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="../query-builder.css">
<link rel="stylesheet" href="../dist/query-builder.min.css">
</head>

<body>
Expand All @@ -27,7 +27,7 @@ <h3>Output</h3>
</div>

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

<script>
// define filters
Expand Down

0 comments on commit 911b3b7

Please sign in to comment.