Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-cli

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-cli

The grunt command line interface.

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
380K
decreased by-57.24%
Maintainers
1
Weekly downloads
 
Created

What is grunt-cli?

The grunt-cli package is the command line interface for Grunt, a JavaScript task runner. It allows you to automate repetitive tasks such as minification, compilation, unit testing, linting, and more.

What are grunt-cli's main functionalities?

Task Automation

This code sample demonstrates how to automate the task of JavaScript file minification using the 'uglify' plugin. The 'uglify' task reads a source file and outputs a minified version.

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      build: {
        src: 'src/<%= pkg.name %>.js',
        dest: 'build/<%= pkg.name %>.min.js'
      }
    }
  });
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.registerTask('default', ['uglify']);
};

File Watching

This code sample shows how to set up a file watcher that monitors JavaScript files for changes and runs the 'jshint' task whenever a change is detected.

module.exports = function(grunt) {
  grunt.initConfig({
    watch: {
      scripts: {
        files: ['**/*.js'],
        tasks: ['jshint'],
        options: {
          spawn: false,
        },
      },
    },
  });
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.registerTask('default', ['watch']);
};

Compilation

This code sample demonstrates how to compile Sass files into CSS using the 'sass' plugin. The 'sass' task reads a Sass file and outputs a compiled CSS file.

module.exports = function(grunt) {
  grunt.initConfig({
    sass: {
      dist: {
        files: {
          'main.css': 'main.scss'
        }
      }
    }
  });
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.registerTask('default', ['sass']);
};

Other packages similar to grunt-cli

FAQs

Package last updated on 19 Nov 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc