Automates using Apache Flex to compile .as files to .swf.
Note: you must install the Apache Flex SDK separately and then configure this plugin with the path to the SDK.
This plugin requires Grunt.
If 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:
npm install grunt-swf --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-swf');
In your project's Gruntfile, add a section named swf
to the data object passed into grunt.initConfig()
.
We'll get to the flex-sdk-path
in a minute.
grunt.initConfig({
swf: {
options: {
'flex-sdk-path': './path-to-flex-sdk'
},
'dist/filename.swf' : 'src/filename.as'
},
// ...
})
Installing the Flex SDK is a two-step process:
- Download and install the "SDK Installer" from https://flex.apache.org/installer.html
- that installs a program named "Apache Flex SDK Installer". Run it to download the actual SDK.
Take note of the folder you install the SDK into in step 2. and add it to your grunt config.
After this, grunt swf
should be able to compile compile your configured .as files.
This plugin plays nice with grunt-newer - use it to avoid unnecessarily re-generating your .swf files when the .as source hasn't changed.
- Switched from native
mv
to mv package to support a wider range of environments.
- Initial release, extracted code from https://github.com/nfriedly/Javascript-Flash-Cookies and added tests.
Copyright (c) 2014 Nathan Friedly. Licensed under the MIT license.