Advertisement
Guest User

Gruntfile.js

a guest
Jul 1st, 2014
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Generated on 2014-06-16 using generator-jekyllrb 1.2.1
  2. 'use strict';
  3.  
  4. // Directory reference:
  5. //   css: css
  6. //   compass: _styles
  7. //   javascript: js
  8. //   coffeescript: _scripts
  9. //   images: img
  10. //   fonts: fonts
  11.  
  12. module.exports = function (grunt) {
  13.   // Show elapsed time after tasks run
  14.   require('time-grunt')(grunt);
  15.   // Load all Grunt tasks
  16.   require('load-grunt-tasks')(grunt);
  17.  
  18.   grunt.initConfig({
  19.     // Configurable paths
  20.     yeoman: {
  21.       app: 'app',
  22.       dist: 'dist'
  23.     },
  24.     watch: {
  25.       compass: {
  26.         files: ['<%= yeoman.app %>/_styles/**/*.{scss,sass}'],
  27.         tasks: ['compass:server', 'autoprefixer:server']
  28.       },
  29.       autoprefixer: {
  30.         files: ['<%= yeoman.app %>/css/**/*.css'],
  31.         tasks: ['copy:stageCss', 'autoprefixer:server']
  32.       },
  33.       coffee: {
  34.         files: ['<%= yeoman.app %>/_scripts/**/*.coffee'],
  35.         tasks: ['coffee:dist']
  36.       },
  37.       coffeeTest: {
  38.         files: ['test/spec/**/*.coffee'],
  39.         tasks: ['coffee:test']
  40.       },
  41.       jekyll: {
  42.         files: [
  43.           '<%= yeoman.app %>/**/*.{html,yml,md,mkd,markdown}',
  44.           '!<%= yeoman.app %>/_bower_components/**/*'
  45.         ],
  46.         tasks: ['jekyll:server']
  47.       },
  48.       livereload: {
  49.         options: {
  50.           livereload: '<%= connect.options.livereload %>'
  51.         },
  52.         files: [
  53.           '.jekyll/**/*.html',
  54.           '.tmp/css/**/*.css',
  55.           '{.tmp,<%= yeoman.app %>}/<%= js %>/**/*.js',
  56.           '<%= yeoman.app %>/img/**/*.{gif,jpg,jpeg,png,svg,webp}'
  57.         ]
  58.       }
  59.     },
  60.     connect: {
  61.       options: {
  62.         port: 9000,
  63.         livereload: 35729,
  64.         // change this to '0.0.0.0' to access the server from outside
  65.         hostname: 'localhost'
  66.       },
  67.       livereload: {
  68.         options: {
  69.           open: true,
  70.           base: [
  71.             '.tmp',
  72.             '.jekyll',
  73.             '<%= yeoman.app %>'
  74.           ]
  75.         }
  76.       },
  77.       dist: {
  78.         options: {
  79.           open: true,
  80.           base: [
  81.             '<%= yeoman.dist %>'
  82.           ]
  83.         }
  84.       },
  85.       test: {
  86.         options: {
  87.           base: [
  88.             '.tmp',
  89.             '.jekyll',
  90.             'test',
  91.             '<%= yeoman.app %>'
  92.           ]
  93.         }
  94.       }
  95.     },
  96.     clean: {
  97.       dist: {
  98.         files: [{
  99.           dot: true,
  100.           src: [
  101.             '<%= yeoman.dist %>/*',
  102.             // Running Jekyll also cleans the target directory.  Exclude any
  103.             // non-standard `keep_files` here (e.g., the generated files
  104.             // directory from Jekyll Picture Tag).
  105.             '!<%= yeoman.dist %>/.git*'
  106.           ]
  107.         }]
  108.       },
  109.       server: [
  110.         '.tmp',
  111.         '.jekyll'
  112.       ]
  113.     },
  114.     compass: {
  115.       options: {
  116.         // If you're using global Sass gems, require them here.
  117.         // require: ['singularity', 'jacket'],
  118.         bundleExec: true,
  119.         sassDir: '<%= yeoman.app %>/_styles',
  120.         cssDir: '.tmp/css',
  121.         imagesDir: '<%= yeoman.app %>/img',
  122.         javascriptsDir: '<%= yeoman.app %>/js',
  123.         relativeAssets: false,
  124.         httpImagesPath: '/img',
  125.         httpGeneratedImagesPath: '/img/generated',
  126.         outputStyle: 'expanded',
  127.         raw: 'extensions_dir = "<%= yeoman.app %>/_bower_components"\n'
  128.       },
  129.       dist: {
  130.         options: {
  131.           generatedImagesDir: '<%= yeoman.dist %>/img/generated'
  132.         }
  133.       },
  134.       server: {
  135.         options: {
  136.           debugInfo: true,
  137.           generatedImagesDir: '.tmp/img/generated'
  138.         }
  139.       }
  140.     },
  141.     autoprefixer: {
  142.       options: {
  143.         browsers: ['last 2 versions']
  144.       },
  145.       dist: {
  146.         files: [{
  147.           expand: true,
  148.           cwd: '<%= yeoman.dist %>/css',
  149.           src: '**/*.css',
  150.           dest: '<%= yeoman.dist %>/css'
  151.         }]
  152.       },
  153.       server: {
  154.         files: [{
  155.           expand: true,
  156.           cwd: '.tmp/css',
  157.           src: '**/*.css',
  158.           dest: '.tmp/css'
  159.         }]
  160.       }
  161.     },
  162.     coffee: {
  163.       dist: {
  164.         files: [{
  165.           expand: true,
  166.           cwd: '<%= yeoman.app %>/_scripts',
  167.           src: '**/*.coffee',
  168.           dest: '.tmp/js',
  169.           ext: '.js'
  170.         }]
  171.       },
  172.       test: {
  173.         files: [{
  174.           expand: true,
  175.           cwd: 'test/spec',
  176.           src: '**/*.coffee',
  177.           dest: '.tmp/spec',
  178.           ext: '.js'
  179.         }]
  180.       }
  181.     },
  182.     jekyll: {
  183.       options: {
  184.         bundleExec: true,
  185.         config: '_config.yml,_config.build.yml',
  186.         src: '<%= yeoman.app %>'
  187.       },
  188.       dist: {
  189.         options: {
  190.           dest: '<%= yeoman.dist %>',
  191.         }
  192.       },
  193.       server: {
  194.         options: {
  195.           config: '_config.yml',
  196.           dest: '.jekyll'
  197.         }
  198.       },
  199.       check: {
  200.         options: {
  201.           doctor: true
  202.         }
  203.       }
  204.     },
  205.     useminPrepare: {
  206.       options: {
  207.         dest: '<%= yeoman.dist %>'
  208.       },
  209.       html: '<%= yeoman.dist %>/index.html'
  210.     },
  211.     usemin: {
  212.       options: {
  213.         assetsDirs: '<%= yeoman.dist %>',
  214.       },
  215.       html: ['<%= yeoman.dist %>/**/*.html'],
  216.       css: ['<%= yeoman.dist %>/css/**/*.css']
  217.     },
  218.     htmlmin: {
  219.       dist: {
  220.         options: {
  221.           collapseWhitespace: true,
  222.           collapseBooleanAttributes: true,
  223.           removeAttributeQuotes: true,
  224.           removeRedundantAttributes: true
  225.         },
  226.         files: [{
  227.           expand: true,
  228.           cwd: '<%= yeoman.dist %>',
  229.           src: '**/*.html',
  230.           dest: '<%= yeoman.dist %>'
  231.         }]
  232.       }
  233.     },
  234.     // Usemin adds files to concat
  235.     concat: {},
  236.     // Usemin adds files to uglify
  237.     uglify: {},
  238.     // Usemin adds files to cssmin
  239.     cssmin: {
  240.       dist: {
  241.         options: {
  242.           check: 'gzip'
  243.         }
  244.       }
  245.     },
  246.     imagemin: {
  247.       dist: {
  248.         options: {
  249.           progressive: true
  250.         },
  251.         files: [{
  252.           expand: true,
  253.           cwd: '<%= yeoman.dist %>',
  254.           src: '**/*.{jpg,jpeg,png}',
  255.           dest: '<%= yeoman.dist %>'
  256.         }]
  257.       }
  258.     },
  259.     svgmin: {
  260.       dist: {
  261.         files: [{
  262.           expand: true,
  263.           cwd: '<%= yeoman.dist %>',
  264.           src: '**/*.svg',
  265.           dest: '<%= yeoman.dist %>'
  266.         }]
  267.       }
  268.     },
  269.     copy: {
  270.       dist: {
  271.         files: [{
  272.           expand: true,
  273.           dot: true,
  274.           cwd: '<%= yeoman.app %>',
  275.           src: [
  276.             // Jekyll processes and moves HTML and text files.
  277.             // Usemin moves CSS and javascript inside of Usemin blocks.
  278.             // Copy moves asset files and directories.
  279.             'img/**/*',
  280.             'fonts/**/*',
  281.             // Like Jekyll, exclude files & folders prefixed with an underscore.
  282.             '!**/_*{,/**}',
  283.             // Explicitly add any files your site needs for distribution here.
  284.             // '_bower_components/jquery/jquery.js',
  285.             //'favicon.ico',
  286.             //'apple-touch*.png'
  287.           ],
  288.           dest: '<%= yeoman.dist %>'
  289.         }]
  290.       },
  291.       // Copy CSS into .tmp directory for Autoprefixer processing
  292.       stageCss: {
  293.         files: [{
  294.           expand: true,
  295.           dot: true,
  296.           cwd: '<%= yeoman.app %>/css',
  297.           src: '**/*.css',
  298.           dest: '.tmp/css'
  299.         }]
  300.       }
  301.     },
  302.     filerev: {
  303.       options: {
  304.         length: 4
  305.       },
  306.       dist: {
  307.         files: [{
  308.           src: [
  309.             '<%= yeoman.dist %>/js/**/*.js',
  310.             '<%= yeoman.dist %>/css/**/*.css',
  311.             '<%= yeoman.dist %>/img/**/*.{gif,jpg,jpeg,png,svg,webp}',
  312.             '<%= yeoman.dist %>/fonts/**/*.{eot*,otf,svg,ttf,woff}'
  313.           ]
  314.         }]
  315.       }
  316.     },
  317.     buildcontrol: {
  318.       dist: {
  319.         options: {
  320.           remote: 'https://github.com/arturbalabanov/arturbalabanov.github.io.git',
  321.           branch: 'master',
  322.           commit: true,
  323.           push: true
  324.         }
  325.       }
  326.     },
  327.     coffeelint: {
  328.       options: {
  329.         'max_line_length': {
  330.           'level': 'ignore'
  331.         }
  332.       },
  333.       check: ['<%= yeoman.app %>/_scripts/*.coffee']
  334.     },
  335.     jshint: {
  336.       options: {
  337.         jshintrc: '.jshintrc',
  338.         reporter: require('jshint-stylish')
  339.       },
  340.       all: [
  341.         'Gruntfile.js',
  342.         '<%= yeoman.app %>/js/**/*.js',
  343.         'test/spec/**/*.js'
  344.       ]
  345.     },
  346.     csslint: {
  347.       options: {
  348.         csslintrc: '.csslintrc'
  349.       },
  350.       check: {
  351.         src: [
  352.           '<%= yeoman.app %>/css/**/*.css',
  353.           '<%= yeoman.app %>/_styles/**/*.scss'
  354.         ]
  355.       }
  356.     },
  357.     concurrent: {
  358.       server: [
  359.         'compass:server',
  360.         'coffee:dist',
  361.         'copy:stageCss',
  362.         'jekyll:server'
  363.       ],
  364.       dist: [
  365.         'compass:dist',
  366.         'coffee:dist',
  367.         'copy:dist'
  368.       ]
  369.     }
  370.   });
  371.  
  372.   // Define Tasks
  373.   grunt.registerTask('serve', function (target) {
  374.     if (target === 'dist') {
  375.       return grunt.task.run(['build', 'connect:dist:keepalive']);
  376.     }
  377.  
  378.     grunt.task.run([
  379.       'clean:server',
  380.       'concurrent:server',
  381.       'autoprefixer:server',
  382.       'connect:livereload',
  383.       'watch'
  384.     ]);
  385.   });
  386.  
  387.   grunt.registerTask('server', function () {
  388.     grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
  389.     grunt.task.run(['serve']);
  390.   });
  391.  
  392.   // No real tests yet. Add your own.
  393.   grunt.registerTask('test', [
  394.   //   'clean:server',
  395.   //   'concurrent:test',
  396.   //   'connect:test'
  397.   ]);
  398.  
  399.   grunt.registerTask('check', [
  400.     'clean:server',
  401.     'jekyll:check',
  402.     'compass:server',
  403.     'coffeelint:check',
  404.     'coffee:dist',
  405.     'jshint:all',
  406.     'csslint:check'
  407.   ]);
  408.  
  409.   grunt.registerTask('build', [
  410.     'clean',
  411.     // Jekyll cleans files from the target directory, so must run first
  412.     'jekyll:dist',
  413.     'concurrent:dist',
  414.     'useminPrepare',
  415.     'concat',
  416.     'autoprefixer:dist',
  417.     'cssmin',
  418.     'uglify',
  419.     'imagemin',
  420.     'svgmin',
  421.     'filerev',
  422.     'usemin',
  423.     'htmlmin'
  424.     ]);
  425.  
  426.   grunt.registerTask('deploy', [
  427.     'check',
  428.     'test',
  429.     'build',
  430.     'buildcontrol'
  431.     ]);
  432.  
  433.   grunt.registerTask('default', [
  434.     'check',
  435.     'test',
  436.     'build'
  437.   ]);
  438. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement