Last active
          August 5, 2017 11:59 
        
      - 
      
- 
        Save inkbase/9608766 to your computer and use it in GitHub Desktop. 
    A Gruntfile to set up a Sass/Jade project
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | module.exports = function(grunt) { | |
| // configure the tasks | |
| grunt.initConfig({ | |
| pkg: grunt.file.readJSON('package.json'), | |
| // copy from the source directory to build | |
| copy: { | |
| build: { | |
| cwd: 'source', | |
| src: [ '**', '!**/*.jade', '!sass', '!sass/*', '!**/*.scss', '!partials', '!partials/*' ], | |
| dest: 'build', | |
| expand: true | |
| }, | |
| }, | |
| // clean the build directory | |
| clean: { | |
| build: { | |
| src: [ 'build' ] | |
| }, | |
| }, | |
| watch: { | |
| sass: { | |
| files: [ 'source/sass/*.scss', 'source/sass/*/*.scss' ], | |
| tasks: [ 'sass' ] | |
| }, | |
| jade: { | |
| files: 'source/**/*.jade', | |
| tasks: [ 'jade' ] | |
| }, | |
| copy: { | |
| files: [ 'source/**', '!source/**/*.scss', '!source/**/*.jade' ], | |
| tasks: [ 'copy' ] | |
| } | |
| }, | |
| jade: { | |
| compile: { | |
| options: { | |
| data: {} | |
| }, | |
| files: [{ | |
| expand: true, | |
| cwd: 'source', | |
| src: [ '**/*.jade' ], | |
| dest: 'build', | |
| ext: '.html' | |
| }] | |
| } | |
| }, | |
| sass: { | |
| dist: { | |
| files: [{ | |
| expand: true, | |
| cwd: 'source/sass', | |
| src: [ '*.scss' ], | |
| dest: 'build/style', | |
| ext: '.css' | |
| }] | |
| } | |
| }, | |
| connect: { | |
| server: { | |
| options: { | |
| port: 4000, | |
| base: 'build', | |
| hostname: '*' | |
| } | |
| } | |
| } | |
| }); | |
| // load the tasks | |
| grunt.loadNpmTasks('grunt-contrib-copy'); | |
| grunt.loadNpmTasks('grunt-contrib-watch'); | |
| grunt.loadNpmTasks('grunt-contrib-clean'); | |
| grunt.loadNpmTasks('grunt-contrib-jade'); | |
| grunt.loadNpmTasks('grunt-contrib-sass'); | |
| grunt.loadNpmTasks('grunt-contrib-connect'); | |
| // define the tasks | |
| grunt.registerTask( | |
| 'build', | |
| [ 'clean', 'copy', 'jade', 'sass' ] | |
| ); | |
| grunt.registerTask( | |
| 'default', | |
| ['build', 'connect', 'watch'] | |
| //['watch'] | |
| ); | |
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "name": "ProjectName", | |
| "description": "Just testing out my workflow.", | |
| "version": "0.1.0", | |
| "author": "Jason Landry", | |
| "private": true, | |
| "devDependencies": { | |
| "grunt": "~0.4.x", | |
| "grunt-contrib-sass": "~0.7.x", | |
| "grunt-contrib-watch": "~0.6.x", | |
| "grunt-contrib-jade": "~0.11.x", | |
| "grunt-contrib-connect": "0.7.x", | |
| "grunt-contrib-clean": "0.5.x", | |
| "grunt-contrib-copy": "0.5.x", | |
| "grunt-mkdir": "0.1.x" | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment