LoginSignup
5
5

More than 5 years have passed since last update.

ぼくのGruntfile

Posted at

Gruntfileを晒そうかと思います。
スタイルはSsss+Compassを使用しています。

プロジェクト構造

|- Gruntfile.coffee
|- package.json
|- config.rb
|- js
|- css
|- src
 |- scss
 |- js

Gruntfile

  • ソースがスッキリするのでcoffee形式で記述
  • CSSの圧縮と出力先については、Compassを使用しているので、config.rbで設定
  • ライブリロードを有効にしているので、別途Chromeエクステンションをインストールしている
Gruntfile.coffee
'use strict'
module.exports = (grunt) ->

    grunt.initConfig

        pkg: grunt.file.readJSON 'package.json'

        watch:
            options:
                livereload: true
            js:
                files: ['src/js/*.js']
                tasks: ['uglify']
            compass:
                files: ['src/scss/**/*.scss']
                tasks: ['compass']

        uglify:
            myscript:
                files: [
                    expand: true,
                    cwd: 'src/js/',
                    src: ['**/*.js'],
                    dest: 'js/',
                    ext: '.min.js'
                ]

        compass:
            dist:
                options:
                    config: 'config.rb'
                    force: true

    grunt.loadNpmTasks 'grunt-contrib-watch'
    grunt.loadNpmTasks 'grunt-contrib-uglify'
    grunt.loadNpmTasks 'grunt-contrib-compass'

    grunt.registerTask 'default', ['watch']

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5