gruntjs

grunt: how to generate jshint output as HTML

蓝咒 提交于 2019-12-23 16:33:53
问题 I'm trying to run jshint using grunt. This works, but now I would like the output to be HTML. Here is my grunt file module.exports = function(grunt) { // Project configuration. grunt.initConfig({ jshint: { all: ['Gruntfile.js', 'src/*.js'] , options: { //reporter: 'jslint' reporter:'checkstyle' , reporterOutput: 'jshint.html' } } }); grunt.loadNpmTasks('grunt-contrib-jshint'); }; Running this grunt taks, the output is in XML. Any suggestion how to turn this into something that outputs HTML ?

How do I generate a list of files in html, using a grunt task?

≡放荡痞女 提交于 2019-12-23 16:19:31
问题 I am using yeoman, grunt and angularjs and am new to grunt. I have some content generation that produces something like this, already copied to the dist folder. /dist/whatever/x/a.html /dist/whatever/y/b.html /dist/whatever/x/c.html I would like to create another html file using a grunt task: /dist/whatever/index.html Which contains: ... <a href="x/a.html">x</x> <a href="y/b.html">x</x> <a href="x/c.html">x</x> ... This html file can exist in my /app folder as a template, and have grunt

GruntJS “bus error grunt watch”

≯℡__Kan透↙ 提交于 2019-12-23 11:51:42
问题 I'm having an error with GruntJS when I try to run a grunt watch . It works fine, until there is a change in the file it is watching, then, it looks something like this: Running "watch" task Waiting...[1] 2464 bus error grunt watch The number 2464 changes. It seems to be the port that grunt is watching on? But, I'm not sure. Here is my Gruntfile: module.exports = function (grunt) { "use strict"; grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), sass: { dist: { options: { style:

Grunt Babel Taking 6 Seconds Per File

a 夏天 提交于 2019-12-23 10:26:09
问题 I'm trying to use Babel in my grunt build process to transpile my .js project files from ES6 to ES5. I have a watch task watching my .js directory for changes and when changes are detected, I run the babel task. For some reason though, changing just one .js file takes anywhere between 6-10 seconds to complete. I have a feeling it's transpiling the entire project, but I'm not sure. My Gruntfile.js looks like this: grunt.initConfig({ watch: { babel: { files: ["<%= yeoman.app %>/scripts/**/*.js"

Alternate grunt.js tasks for development/production environments

爷,独闯天下 提交于 2019-12-23 09:49:29
问题 I would really love to be able to have a development grunt file and using the same file an production version of the script. I have tried the suggestion on SO but my script will just fail when trying to call a dev/prod argument. I believe that the answer is for an older version of grunt, or maybe the plugins I am using. module.exports = function (grunt) { // load all grunt tasks require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); grunt.initConfig({ pkg: grunt.file.readJSON(

Grunt is not defined

假装没事ソ 提交于 2019-12-23 09:49:11
问题 Just Getting started with grunt, and when I run grunt I get this error Loading "Gruntfile.js" tasks...ERROR >> ReferenceError: grunt is not defined This is my Gruntfile.js module.exports = function(grunt){ 'use strict'; }; 回答1: I had it suddenly happen to me, 'use strict'; module.exports = function(grunt) { grunt.initConfig({ sass: { dist: { files: { 'style.css': 'style.scss' }, options: { includePaths: ['css/'], outputStyle: 'nested' } } }, }); grunt.loadNpmTasks('grunt-sass'); grunt

phantomjs cannot start up

ε祈祈猫儿з 提交于 2019-12-23 09:18:23
问题 I used AngularJS in my project and karma to test. Then I configured karma like this: config.set({ basePath: '../', frameworks: ['jasmine'], files: [ // bower:js 'bower_components/jquery/dist/jquery.js', 'bower_components/angular/angular.js', 'bower_components/bootstrap/dist/js/bootstrap.js', 'bower_components/angular-animate/angular-animate.js', 'bower_components/angular-cookies/angular-cookies.js', 'bower_components/angular-route/angular-route.js', 'bower_components/angular-sanitize/angular

Defining 'package' information in component.json and package.json

牧云@^-^@ 提交于 2019-12-23 09:07:40
问题 I'm creating a javascript library that I want make available through Bower to my internal company. I'm using Grunt to build my library. My issue is that grunt's convention is to use package.json to define dependencies, library versions, dependencies, etc. Bower, on the other hand, assumes that that same information is found in a component.json file. What's the intended use of these two? They seem to serve essentially the same purpose. Do I need to create both and cut and paste the shared

Grunt config with es6

Deadly 提交于 2019-12-23 08:57:18
问题 It is possible to write grunt config files in es6 like this? //Gruntfile.js module.exports = function (grunt) { var arr = [1,2,3]; arr.forEach(val => { ... }); ... } 回答1: One possible way to do this painlessly is to use Babel's babel-register module like this: Installation: npm install babel-register --save-dev .babelrc: { presets: ["es2015"] } Gruntfile.js: require('babel-register') module.exports = require('./Gruntfile.es').default Gruntfile.es export default function(grunt) { grunt

Yeoman 'grunt test' fails on clean project with 'port already in use'

╄→гoц情女王★ 提交于 2019-12-23 08:56:33
问题 With: Mac OS 10.8.4 Node 0.10.12 npm 1.3.1 grunt-cli 0.1.9 yo 1.0.0-rc.1 bower 0.9.2 generator-angular@0.3.0 I encounter the following error with a clean yo angular project, followed by grunt server then grunt test : Running "connect:test" (connect) task Fatal error: Port 9000 is already in use by another process. I'm new to Yeoman and am stumped. I've deleted my original project and created a new one in a fresh folder just to make sure I wasn't overlooking any invisible configs. I restarted