PageRenderTime 25ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/illdy/gruntfile.js

https://gitlab.com/MichaelSchober/bambooclassesmompiche
JavaScript | 312 lines | 184 code | 31 blank | 97 comment | 0 complexity | 53fbaa190a0bbf7011dd1bba114efb32 MD5 | raw file
  1. 'use strict';
  2. module.exports = function(grunt){
  3. // load all tasks
  4. require('load-grunt-tasks')(grunt, {scope: 'devDependencies'});
  5. grunt.initConfig({
  6. pkg: grunt.file.readJSON('package.json'),
  7. makepot: {
  8. target: {
  9. options: {
  10. domainPath: '/languages/', // Where to save the POT file.
  11. potFilename: '<%= pkg.name %>.pot', // Name of the POT file.
  12. potHeaders: {
  13. poedit: true, // Includes common Poedit headers.
  14. 'x-poedit-keywordslist': true // Include a list of all possible gettext functions.
  15. }, // Headers to add to the generated POT file.
  16. processPot: function( pot, options ) {
  17. pot.headers['report-msgid-bugs-to'] = 'http://www.machothemes.com/';
  18. pot.headers['language-team'] = 'Macho Themes <support@machothemes.com>';
  19. pot.headers['last-translator'] = 'Macho Themes <support@machothemes.com>';
  20. pot.headers['language-team'] = 'Macho Themes <support@machothemes.com>';
  21. return pot;
  22. },
  23. updateTimestamp: true, // Whether the POT-Creation-Date should be updated without other changes.
  24. type: 'wp-theme', // Type of project (wp-plugin or wp-theme).
  25. }
  26. }
  27. },
  28. clean: {
  29. init: {
  30. src: ['build/']
  31. },
  32. build: {
  33. src: [
  34. 'build/*',
  35. '!build/<%= pkg.name %>.zip'
  36. ]
  37. },
  38. cssmin: {
  39. src: ['layout/css/*.min.css']
  40. },
  41. jsmin: {
  42. src: [
  43. 'layout/js/*.min.js',
  44. 'layout/js/*.min.js.map',
  45. 'layout/js/**/*.min.js',
  46. 'layout/js/**/*.min.js.map'
  47. ]
  48. }
  49. },
  50. copy: {
  51. readme: {
  52. src: 'readme.md',
  53. dest: 'build/readme.txt'
  54. },
  55. build: {
  56. expand: true,
  57. src: ['**', '!node_modules/**', '!build/**', '!readme.md', '!Gruntfile.js', '!package.json' ],
  58. dest: 'build/'
  59. }
  60. },
  61. compress: {
  62. build: {
  63. options: {
  64. pretty: true, // Pretty print file sizes when logging.
  65. archive: 'build/<%= pkg.name %>.zip'
  66. },
  67. expand: true,
  68. cwd: 'build/',
  69. src: ['**/*'],
  70. dest: '<%= pkg.name %>/'
  71. }
  72. },
  73. uglify: {
  74. options: {
  75. sourceMap: true,
  76. compress: {},
  77. },
  78. dynamic_mappings: {
  79. files: [
  80. {
  81. expand: true, // Enable dynamic expansion.
  82. cwd: 'layout/js/', // Src matches are relative to this path.
  83. src: ['**/*.js'], // Actual pattern(s) to match.
  84. dest: 'layout/js/', // Destination path prefix.
  85. ext: '.min.js', // Dest filepaths will have this extension.
  86. extDot: 'first' // Extensions in filenames begin after the first dot
  87. },
  88. ],
  89. },
  90. },
  91. checktextdomain: {
  92. standard: {
  93. options:{
  94. text_domain: [ 'illdy'], //Specify allowed domain(s)
  95. create_report_file: "true",
  96. keywords: [ //List keyword specifications
  97. '__:1,2d',
  98. '_e:1,2d',
  99. '_x:1,2c,3d',
  100. 'esc_html__:1,2d',
  101. 'esc_html_e:1,2d',
  102. 'esc_html_x:1,2c,3d',
  103. 'esc_attr__:1,2d',
  104. 'esc_attr_e:1,2d',
  105. 'esc_attr_x:1,2c,3d',
  106. '_ex:1,2c,3d',
  107. '_n:1,2,4d',
  108. '_nx:1,2,4c,5d',
  109. '_n_noop:1,2,3d',
  110. '_nx_noop:1,2,3c,4d'
  111. ]
  112. },
  113. files: [{
  114. src: [
  115. '**/*.php',
  116. '!**/node_modules/**',
  117. '!**/framework/updater/**',
  118. '!**/framework/importer/**',
  119. '!**/framework/plugins/**',
  120. ], //all php
  121. expand: true,
  122. }],
  123. }
  124. },
  125. imagemin: {
  126. jpg: {
  127. options: {
  128. progressive: true
  129. },
  130. },
  131. png: {
  132. options: {
  133. optimizationLevel: 7
  134. },
  135. },
  136. dynamic: {
  137. files: [{
  138. expand: true,
  139. cwd: 'layout/images/',
  140. src: ['**/*.{png,jpg,gif}'],
  141. dest: 'layout/images/'
  142. }]
  143. }
  144. },
  145. 'ftp-deploy': {
  146. lite: {
  147. auth: {
  148. // Your hostname.
  149. host: 'machothemes.com',
  150. // Default FTP port, leave this alone.
  151. port: 21,
  152. // Key name defined in `.ftppass` for your FTP account.
  153. authKey: 'key1'
  154. },
  155. // Path to the folder you're interested in relative to `Gruntfile.js`.
  156. src: './',
  157. // Path to your destination folder, relative to the server root.
  158. dest: '/public_html/pixova-lite/wp-content/themes/pixova-lite/',
  159. // Files you don't want uploaded, relative to `Gruntfile.js`
  160. exclusions: [
  161. '.DS_Store',
  162. '.gitignore',
  163. '.ftppass',
  164. 'node_modules',
  165. 'bower_components',
  166. '.standard.json',
  167. '.Gruntfile.js',
  168. 'bower.json',
  169. '_.bowerrc',
  170. 'package.json'
  171. ]
  172. },
  173. premium: {
  174. auth: {
  175. // Your hostname.
  176. host: 'machothemes.com',
  177. // Default FTP port, leave this alone.
  178. port: 21,
  179. // Key name defined in `.ftppass` for your FTP account.
  180. authKey: 'key1'
  181. },
  182. // Path to the folder you're interested in relative to `Gruntfile.js`.
  183. src: './',
  184. // Path to your destination folder, relative to the server root.
  185. dest: '/public_html/pixova/wp-content/themes/pixova-premium/',
  186. // Files you don't want uploaded, relative to `Gruntfile.js`
  187. exclusions: [
  188. '.DS_Store',
  189. '.gitignore',
  190. '.ftppass',
  191. 'node_modules',
  192. 'bower_components',
  193. '.standard.json',
  194. '.Gruntfile.js',
  195. 'bower.json',
  196. '_.bowerrc',
  197. 'package.json'
  198. ]
  199. },
  200. },
  201. cssmin: {
  202. target: {
  203. files: [{
  204. expand: true,
  205. cwd: 'layout/css',
  206. src: ['*.css', '!*.min.css'],
  207. dest: 'layout/css',
  208. ext: '.min.css'
  209. }]
  210. }
  211. },
  212. compass: {
  213. dist: {
  214. options: {
  215. sassDir: 'layout/scss',
  216. cssDir: 'layout/css',
  217. environment: 'development',
  218. outputStyle: 'compressed'
  219. }
  220. }
  221. }
  222. });
  223. grunt.registerTask('default', []);
  224. // Build .pot file
  225. grunt.registerTask( 'buildpot', [
  226. 'makepot'
  227. ]);
  228. // Check Missing Text Domain Strings
  229. grunt.registerTask( 'textdomain', [
  230. 'checktextdomain'
  231. ]);
  232. // Minify Images
  233. grunt.registerTask( 'minimg', [
  234. 'imagemin:dynamic'
  235. ]);
  236. // Minify CSS
  237. grunt.registerTask( 'mincss', [
  238. 'clean:cssmin',
  239. 'cssmin'
  240. ]);
  241. // Minify JS
  242. grunt.registerTask( 'minjs', [
  243. 'clean:jsmin',
  244. 'uglify'
  245. ]);
  246. // Task to minify all static resources
  247. grunt.registerTask( 'allmin', [
  248. 'minimg',
  249. 'mincss',
  250. 'minjs'
  251. ]);
  252. // FTP deploy -> lite version
  253. grunt.registerTask( 'deploy-prod-lite', [
  254. 'ftp-deploy:lite'
  255. ]);
  256. // FTP deploy -> pro version
  257. grunt.registerTask( 'deploy-prod-pro', [
  258. 'ftp-deploy:premium'
  259. ]);
  260. grunt.registerTask( 'scss', [
  261. 'compass'
  262. ]);
  263. grunt.registerTask( 'buildcss', [
  264. 'compass',
  265. 'scss',
  266. 'mincss'
  267. ]);
  268. // Build task
  269. grunt.registerTask( 'build-archive', [
  270. 'makepot',
  271. 'scss',
  272. 'allmin',
  273. 'clean:init',
  274. 'copy',
  275. 'compress:build',
  276. 'clean:build'
  277. ]);
  278. };