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