Skip to content

Latest commit

 

History

History
89 lines (73 loc) · 1.79 KB

CHEATSHEET.md

File metadata and controls

89 lines (73 loc) · 1.79 KB

Examples

We have a templates/backbone/View.js and templates/grunt/taskConfig.js file.

With dest

generate : {
	options : {
		dest : "app/scripts"
	}
}
grunt generate:backbone/View:TestView
#creates file '<project>/app/scripts/TestView.js'

grunt generate:backbone/View:TestView@login/views
#creates file '<project>/app/scripts/login/views/TestView.js'

#note the / before 'config', it tells the task to override `dest`
grunt generate:grunt/taskConfig:jshint@/config
#creates file '<project>/config/jshint.js'

With directory mapping

generate : {
	options : {
		dest : "app/scripts"
		map : {
			grunt: "/config" //note the / before `config`, it tells the task to override `dest`
		}
	}
}
grunt generate:grunt/taskConfig:jshint
#creates file '<project>/config/jshint.js'

grunt generate:grunt/taskConfig:jshint@tasks
#creates file '<project>/config/tasks/jshint.js'

With file mapping

generate : {
	options : {
		default : "app/scripts"
		map : {
			"backbone/View" : "views" //no "/" which means views will be generated in `app/scripts/views`
		}
	}
}
grunt generate:backbone/View:TestView
#creates file '<project>/app/scripts/views/TestView.js'

grunt generate:backbone/View:TestView@login
#creates file '<project>/app/scripts/views/login/TestView.js'

With templating

generate : {
	options : {
		default : "app/scripts"
		map : {
			"backbone/View" : ":dir/ui/views"
			"grunt" : "/build/config-:basename"
		}
	}
}
grunt generate:backbone/View:TestView
#creates file '<project>/app/scripts/ui/views/TestView.js'

grunt generate:backbone/View:TestView@login
#creates file '<project>/app/scripts/login/ui/views/TestView.js'

grunt generate:grunt/taskConfig:lint
#creates files '<project>/build/config-lint.js'