Giter Site home page Giter Site logo

grunt-init-gruntfile's Introduction

grunt-init-gruntfile

Create a basic Gruntfile with grunt-init.

Installation

If you haven't already done so, install grunt-init.

Once grunt-init is installed, place this template in your ~/.grunt-init/ directory. It's recommended that you use git to clone this template into that directory, as follows:

git clone https://github.com/gruntjs/grunt-init-gruntfile.git ~/.grunt-init/gruntfile

(Windows users, see the documentation for the correct destination directory path)

Usage

At the command-line, cd into an empty directory, run this command and follow the prompts.

grunt-init gruntfile

Note that this template will generate files in the current directory, so be sure to change to a new directory first if you don't want to overwrite existing files.

grunt-init-gruntfile's People

Contributors

cowboy avatar shama avatar tomasstankovic avatar tomfuertes avatar vladikoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grunt-init-gruntfile's Issues

Creates tasks for qunit but loadNpmTasks references nodeunit

I just grabbed the latest "grunt-init-gruntfile" repo (~1 hour ago) from GitHub. When I did a grunt-init with it, though, the resulting "Gruntfile.js" had tasks for qunit but did a loadNpmTasks("grunt-contrib-nodeunit") instead of grunt-contrib-qunit. Honestly, I'm not sure which was the intended result.

Here is how I answered the grunt-init prompts:

  1. Is the DOM involved in ANY way? (Y/n) Y
  2. Will files be concatenated or minified? (Y/n) Y
  3. Will you have a package.json file? (Y/n) Y
  4. Do you need to make any chnages to the above before continuing? (y/N) N

Resulting Gruntfile.js:

/*global module:false*/
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
      '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
      ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
    // Task configuration.
    concat: {
      options: {
        banner: '<%= banner %>',
        stripBanners: true
      },
      dist: {
        src: ['lib/<%= pkg.name %>.js'],
        dest: 'dist/<%= pkg.name %>.js'
      }
    },
    uglify: {
      options: {
        banner: '<%= banner %>'
      },
      dist: {
        src: '<%= concat.dist.dest %>',
        dest: 'dist/<%= pkg.name %>.min.js'
      }
    },
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: true,
        boss: true,
        eqnull: true,
        browser: true,
        globals: {
          jQuery: true
        }
      },
      gruntfile: {
        src: 'Gruntfile.js'
      },
      lib_test: {
        src: ['lib/**/*.js', 'test/**/*.js']
      }
    },
    qunit: {
      files: ['test/**/*.html']
    },
    watch: {
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
      lib_test: {
        files: '<%= jshint.lib_test.src %>',
        tasks: ['jshint:lib_test', 'qunit']
      }
    }
  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-nodeunit');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');

  // Default task.
  grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']);

};

Looks like there could be a few other minor problems as well, e.g. should it have made a ".jshintrc" file instead of declaring the options in the "Gruntfile.js"?

Generated package.json is missing attributes used in the banner

Hey,

it's quite obvious that developers using the package.json will add the necessary attributes like name and homepage themselves, but for first time users it might be confusing that this grunt template's grunt tasks fails due to missing package attributes (used in the banner config). The outputted warning with a fresh install is:

Running "concat:dist" (concat) task
Warning: An error occurred while processing a template (Cannot read property 'name' of undefined). Use --force to continue.

Should the generated package.json include placeholders or empty values for all attributes used in the banner, and maybe when using the package.json generator print a notice to edit those.

I can provide a PR for this, if needed.

package.json overwritten - surprising

The docs don't mention anywhere that this will nuke the existing package.json - when I said "yes" when asked if I "will have a package.json", I didn't mean that I wanted it destroyed.

support coffeescript

I'd like this to support coffeescript Gruntfiles. Is that something that's already available, or there's any interest in?

git clone

With github newbies,

git clone https://github.com/gruntjs/grunt-init-gruntfile.git

is more full proof than

git clone [email protected]:gruntjs/grunt-init-gruntfile.git

which can give way to a puzzling "Permission denied (publickey)."

Slight error on the Readme file

Works great however under "Usage" section of readme.md instead of :-
grunt-init gruntfile

I think it should be :-
grunt-init grunt-init-gruntfile

Love this tool and grunt too btw. ๐Ÿ‘

Accessing non-existent property 'padLevels' of module exports inside circular dependency

running grunt-init gruntfile results in:

Please answer the following:
[?] Is the DOM involved in ANY way? (Y/n) (node:30284) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)

Using the ? results in:
?
Fatal error: util.error is not a function

Please help, I have just installed latest grunt-cli (1.4.3) and made sure to upgrade npm (10.1.0), node (20.7.0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.