2021-03-21 16:59:11 +00:00
|
|
|
/*jshint esversion: 6 */
|
2014-11-30 12:21:58 +00:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
2021-03-10 17:28:58 +00:00
|
|
|
copy: {
|
|
|
|
js: {
|
|
|
|
expand: true,
|
|
|
|
cwd: './node_modules',
|
|
|
|
dest: './js/',
|
|
|
|
flatten: true,
|
|
|
|
filter: 'isFile',
|
|
|
|
timestamp: true,
|
|
|
|
src: [
|
2021-03-10 18:41:05 +00:00
|
|
|
'./bootstrap/dist/js/bootstrap.min.js',
|
|
|
|
'./corejs-typeahead/dist/typeahead.bundle.min.js',
|
2021-03-10 17:28:58 +00:00
|
|
|
'./jquery/dist/jquery.min.js',
|
|
|
|
'./leaflet/dist/leaflet.js',
|
|
|
|
]
|
|
|
|
},
|
|
|
|
css: {
|
|
|
|
expand: true,
|
|
|
|
cwd: './node_modules',
|
|
|
|
dest: './css/',
|
|
|
|
flatten: true,
|
|
|
|
filter: 'isFile',
|
|
|
|
timestamp: true,
|
|
|
|
src: [
|
2021-03-10 18:41:05 +00:00
|
|
|
'./bootstrap/dist/css/bootstrap-theme.css',
|
|
|
|
'./bootstrap/dist/css/bootstrap-theme.min.css',
|
|
|
|
'./bootstrap/dist/css/bootstrap-theme.min.css.map',
|
2021-03-10 17:28:58 +00:00
|
|
|
'./leaflet/dist/leaflet.css',
|
|
|
|
]
|
|
|
|
},
|
2021-03-10 18:41:05 +00:00
|
|
|
fonts: {
|
|
|
|
expand: true,
|
|
|
|
cwd: './node_modules',
|
|
|
|
dest: './fonts/',
|
|
|
|
flatten: true,
|
|
|
|
filter: 'isFile',
|
|
|
|
timestamp: true,
|
|
|
|
src: [
|
|
|
|
'./bootstrap/dist/fonts/glyphicons-*.*',
|
|
|
|
]
|
|
|
|
},
|
2021-03-10 17:28:58 +00:00
|
|
|
leaflet_images: {
|
|
|
|
expand: true,
|
|
|
|
cwd: './node_modules',
|
|
|
|
dest: './css/images/',
|
|
|
|
flatten: true,
|
|
|
|
filter: 'isFile',
|
|
|
|
timestamp: true,
|
|
|
|
src: [
|
|
|
|
'./leaflet/dist/images/*.png',
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2014-11-30 12:21:58 +00:00
|
|
|
concat: {
|
|
|
|
options: {
|
|
|
|
separator: ';'
|
|
|
|
},
|
|
|
|
dist: {
|
2021-03-22 11:00:48 +00:00
|
|
|
src: ['src/js/*.js', '../__common__/js/image_layout.js'],
|
2014-11-30 12:21:58 +00:00
|
|
|
dest: 'js/searx.js'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
uglify: {
|
|
|
|
options: {
|
2020-12-01 09:07:01 +00:00
|
|
|
sourceMap: true,
|
2020-03-25 13:09:47 +00:00
|
|
|
banner: '/*! oscar/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n'
|
2014-11-30 12:21:58 +00:00
|
|
|
},
|
|
|
|
dist: {
|
|
|
|
files: {
|
|
|
|
'js/searx.min.js': ['<%= concat.dist.dest %>']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
jshint: {
|
2021-03-22 11:00:48 +00:00
|
|
|
files: ['gruntfile.js', 'js/searx_src/*.js', '../__common__/js/image_layout.js'],
|
2014-11-30 12:21:58 +00:00
|
|
|
options: {
|
2019-12-10 17:10:33 +00:00
|
|
|
reporterOutput: "",
|
2014-11-30 12:21:58 +00:00
|
|
|
// options here to override JSHint defaults
|
|
|
|
globals: {
|
|
|
|
jQuery: true,
|
|
|
|
console: true,
|
|
|
|
module: true,
|
|
|
|
document: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2014-12-22 14:28:23 +00:00
|
|
|
less: {
|
2021-03-10 13:17:07 +00:00
|
|
|
development: {
|
|
|
|
options: {
|
2021-03-10 18:41:05 +00:00
|
|
|
paths: ["src/less/pointhi", "src/less/logicodev", "src/less/logicodev-dark", "src/less/bootstrap"]
|
2014-12-22 14:28:23 +00:00
|
|
|
},
|
2021-03-10 13:17:07 +00:00
|
|
|
files: {
|
2021-03-10 18:41:05 +00:00
|
|
|
"css/bootstrap.css": "src/less/bootstrap/bootstrap.less",
|
2021-03-10 14:03:18 +00:00
|
|
|
"css/pointhi.css": "src/less/pointhi/oscar.less",
|
|
|
|
"css/logicodev.css": "src/less/logicodev-dark/oscar.less",
|
|
|
|
"css/logicodev-dark.css": "src/less/logicodev/oscar.less"
|
2021-03-10 13:17:07 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
production: {
|
|
|
|
options: {
|
2021-03-21 16:59:11 +00:00
|
|
|
paths: ["src/less/pointhi", "src/less/logicodev", "src/less/logicodev-dark", "src/less/bootstrap"],
|
2021-03-10 13:17:07 +00:00
|
|
|
plugins: [
|
|
|
|
new (require('less-plugin-clean-css'))()
|
|
|
|
],
|
|
|
|
sourceMap: true,
|
2021-03-21 16:59:11 +00:00
|
|
|
sourceMapURL: (name) => { const s = name.split('/'); return s[s.length - 1] + '.map';},
|
|
|
|
outputSourceFiles: false,
|
|
|
|
sourceMapRootpath: '../'
|
2014-12-22 14:28:23 +00:00
|
|
|
},
|
2021-03-10 13:17:07 +00:00
|
|
|
files: {
|
2021-03-21 16:59:11 +00:00
|
|
|
"css/bootstrap.min.css": "css/bootstrap.css",
|
2021-03-10 17:28:58 +00:00
|
|
|
"css/leaflet.min.css": "css/leaflet.css",
|
2021-03-10 14:03:18 +00:00
|
|
|
"css/pointhi.min.css": "src/less/pointhi/oscar.less",
|
|
|
|
"css/logicodev.min.css": "src/less/logicodev/oscar.less",
|
|
|
|
"css/logicodev-dark.min.css": "src/less/logicodev-dark/oscar.less"
|
2021-03-10 13:17:07 +00:00
|
|
|
}
|
|
|
|
},
|
2014-12-22 14:28:23 +00:00
|
|
|
},
|
2014-11-30 12:21:58 +00:00
|
|
|
watch: {
|
2014-12-22 14:28:23 +00:00
|
|
|
scripts: {
|
|
|
|
files: ['<%= jshint.files %>'],
|
|
|
|
tasks: ['jshint', 'concat', 'uglify']
|
|
|
|
},
|
|
|
|
oscar_styles: {
|
2021-03-10 14:03:18 +00:00
|
|
|
files: ['src/less/pointhi/**/*.less'],
|
2014-12-22 14:28:23 +00:00
|
|
|
tasks: ['less:development', 'less:production']
|
|
|
|
},
|
|
|
|
bootstrap_styles: {
|
|
|
|
files: ['less/bootstrap/**/*.less'],
|
|
|
|
tasks: ['less:bootstrap']
|
|
|
|
}
|
2014-11-30 12:21:58 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-03-10 17:28:58 +00:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
2014-11-30 12:21:58 +00:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
2014-12-22 14:28:23 +00:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-less');
|
2014-11-30 12:21:58 +00:00
|
|
|
|
|
|
|
grunt.registerTask('test', ['jshint']);
|
|
|
|
|
2021-03-10 17:28:58 +00:00
|
|
|
grunt.registerTask('default', ['copy', 'jshint', 'concat', 'uglify', 'less']);
|
2019-12-10 17:10:33 +00:00
|
|
|
|
2014-12-22 14:28:23 +00:00
|
|
|
grunt.registerTask('styles', ['less']);
|
2014-11-30 12:21:58 +00:00
|
|
|
|
|
|
|
};
|