Grunt plugin wrapper for Sencha CMD
npm install grunt-sencha-build> Grunt plugin to use as a wrapper to Sencha CMD.
>=0.4.1If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
``shell`
npm install grunt-sencha-build --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js`
grunt.loadNpmTasks('grunt-sencha-build');
to the data object passed into grunt.initConfig().`js
grunt.initConfig({
// Simple Example
sencha_app_build: {
testing_build: {
environment: 'testing'
}
}
// Full Example
sencha_app_build: {
options: {
cwd: 'your app path',
cmdPath: 'path to Sencha CMD executable'
}
testing_custom_build: {
environment: 'testing'
commandOptions: '-d somefolder'
}
}
})
`$3
#### options.cwd
Type:
String
Default value: The path to your app you want to work with, defaults to the current directory
#### options.cmdPath
Type:
String
Default value: senchaThe full path to the Sencha CMD executable, defaults to 'sencha'
#### options.failOnWarn
Type:
Boolean
Default value: falseA flag to tell the build to fail when it has any warnings
$3
#### environment
Type:
StringThe type of build environment to use, options are production|testing|native|package
$3
#### Simple Package Example
Builds app in current directory using the testing environment
`js
grunt.initConfig({
sencha_app_build: {
testing_build: {
environment: 'testing'
}
}
})
`#### Build different directory with different output directory
Package up the /myappdir into /webroot using the production environment
`js
grunt.initConfig({
sencha_app_build: {
options: {
cwd: '/myappdir'
},
custom_build: {
environment: 'production'
commandOptions: '-d /webroot'
}
}
})
`The "sencha_compile" task
$3
In your project's Gruntfile, add a section named sencha_compile to the data object passed into grunt.initConfig(). This task will run the sencha cmd compile target. See the Sencha CMD documentation for additional options.`js
grunt.initConfig({
// Simple Example
sencha_compile: {
testing_build: {
params: [
"page -i index.html -o output.html"
]
}
}
})
`$3
#### params
Type:
Array
Default value: An array of parameters. If you prefer you can also just make them as one string in the array like above.
The generic "sencha" task
$3
Any task that Sencha CMD supports can be achieved by this grunt task. It just takes the command from grunt's config.`js
grunt.initConfig({
// Simple Example
sencha: {
concat: {
command: [
"fs concat -to=output.js input1.js input2.js input3.js"
]
}
}
})
`$3
#### command
Type:
Array
Default value: `An array of command lines. If you prefer you can also just make them as one string in the array like above.