PluginProbe
Photonic Gallery & Lightbox for Flickr, SmugMug & Others / 3.37
Photonic Gallery & Lightbox for Flickr, SmugMug & Others v3.37
3.37 3.36 3.35 3.34 3.33 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.40 2.41 2.42 2.43 All 142 releases
photonic / grunt / Gruntfile.js

Gruntfile.js in Photonic Gallery & Lightbox for Flickr, SmugMug & Others 3.37, at grunt/Gruntfile.js

147 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 const webpackConfig = require('./webpack.config.js');
2
3 module.exports = function(grunt) {
4 // Config
5 grunt.initConfig({
6 pkg: grunt.file.readJSON('package.json'),
7 dirs: {
8 src_css: '../include/css/front-end/core',
9 tp: '../include/ext',
10
11 dest_js_base: '../include/js/front-end',
12
13 dest_css_combo: '../include/css/front-end/combo',
14 dest_css_combo_slider: '../include/css/front-end/combo-slider',
15
16 i18n_src: '..',
17 langs: 'languages'
18 },
19
20 vars: { },
21
22 webpack: {
23 myConfig: webpackConfig,
24 },
25
26 clean: {
27 css: {
28 options: {
29 force: true
30 },
31 src: [
32 '<%= dirs.dest_css_combo %>',
33 '<%= dirs.dest_css_combo_slider %>'
34 ]
35 },
36 js: {
37 options: {
38 force: true
39 },
40 src: [
41 '<%= dirs.dest_js_base %>/out/**/*.*',
42 ]
43 },
44 jsLicenses: {
45 options: {
46 force: true
47 },
48 src: [
49 '<%= dirs.dest_js_base %>/module/**/*.txt',
50 '<%= dirs.dest_js_base %>/nomodule/**/*.txt',
51 ]
52 },
53 },
54
55 makepot: {
56 target: {
57 options: {
58 type: 'wp-plugin',
59 potFilename: 'photonic.pot',
60 cwd: '<%= dirs.i18n_src %>',
61 domainPath: '<%= dirs.langs %>'
62 }
63 }
64 }
65 });
66
67 // Load plugins
68 const cwd = process.cwd();
69 process.chdir('../../../../..');
70 grunt.loadNpmTasks('grunt-webpack');
71 grunt.loadNpmTasks('grunt-contrib-clean');
72 grunt.loadNpmTasks('grunt-contrib-concat');
73 grunt.loadNpmTasks('grunt-contrib-copy');
74 grunt.loadNpmTasks('grunt-contrib-cssmin');
75 grunt.loadNpmTasks('grunt-wp-i18n');
76 process.chdir(cwd);
77
78 const lightboxes = [
79 'BaguetteBox',
80 'BigPicture',
81 'Colorbox',
82 'Fancybox',
83 'Fancybox2',
84 'Fancybox3',
85 'Featherlight',
86 'GLightbox',
87 'ImageLightbox',
88 'Lightcase',
89 'Lightgallery',
90 'Magnific',
91 'none',
92 'PhotoSwipe',
93 'PrettyPhoto',
94 'Spotlight',
95 'Strip',
96 'Swipebox',
97 'Thickbox',
98 'VenoBox',
99 ];
100
101 function buildCSS() {
102 const tasks = [];
103 grunt.task.run([
104 'clean:css'
105 ]);
106
107 grunt.config(['cssmin', 'core'], {
108 files: [{
109 expand: true,
110 cwd: '<%= dirs.src_css %>',
111 src: ['*.css', '!*.min.css'],
112 dest: '<%= dirs.src_css %>/',
113 ext: '.min.css'
114 }]
115 });
116 tasks.push('cssmin:core');
117
118 grunt.task.run(tasks);
119 }
120
121 function buildPOT() {
122 grunt.task.run([
123 'makepot:target'
124 ]);
125 }
126
127 function buildAll() {
128 buildJS();
129 buildCSS();
130 buildPOT();
131 }
132
133 function buildJS() {
134 // First run WebPack to generate the files. This generates 2 files per library - one minified and the other unminified.
135 grunt.task.run([
136 'clean:js',
137 'webpack',
138 'clean:jsLicenses',
139 ]);
140 }
141
142 grunt.registerTask('buildAll', buildAll);
143 grunt.registerTask('buildCSS', buildCSS);
144 grunt.registerTask('buildPOT', buildPOT);
145 grunt.registerTask('buildJS', buildJS);
146 };
147