Skip to content

Instantly share code, notes, and snippets.

@h2non
Last active December 30, 2015 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h2non/7787640 to your computer and use it in GitHub Desktop.
Save h2non/7787640 to your computer and use it in GitHub Desktop.
Croak example project structure

Croak example project structure and configuration scenario

$HOME
├── .croakrc
└── workspace
    ├── builder
    │   ├── tasks
    │   ├── node_modules
    │   ├── .jshintrc
    │   ├── Gruntfile.js
    │   └── package.json
    │   
    ├── repo1
    │   ├── scripts
    │   ├── images
    │   ├── styles
    │   ├── html
    │   ├── .croakrc
    │   └── bower.json
    │
    └── repo2
        ├── scripts
        ├── images
        ├── styles
        ├── html
        ├── Croakfile.js
        └── bower.json

~/.croakrc

[my-project]
gruntfile = ${HOME}/workspace/builder/Gruntfile.js
extend = true

~/workspace/builder/Gruntfile.js

module.exports = function (grunt) {
  grunt.initConfig({
    clean: ['<%= croak.cwd %>/.tmp', '.tmp'],
    copy: {
      html: {
        expand: true,
        cwd: '<%= croak.cwd %>',
        src: [
          'html/**/*.html',
          'scripts/**/*.js',
          'styles/**/*.js',
          'images/**'
        ],
        dest: '<%= croak.cwd %>/.tmp',
        filter: 'isFile'
      }
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      files: {
        cwd: '<%= croak.cwd %>',
        src: ['scripts/**/*.js']
      }
    },
    connect: {
      demo: {
        options: {
          port: 9000,
          base: '<%= croak.cwd %>/.tmp'
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-connect');

  grunt.registerTask('server', ['clean', 'jshint', 'copy', 'connect']);
};

~/workspace/repo1/.croakrc

$default = my-project

~/workspace/repo2/Croakfile.js

module.exports = function (croak) {
  croak.initConfig({
    connect: {
      images: {
        options: {
          port: 9001,
          base: '<%= croak.cwd %>/images'
        }
      }
    }
  });
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment