- Aurelia - Best Practices
- Aurelia - Community
- Aurelia - Debugging
- Aurelia - Bundling
- Aurelia - Tools
- Aurelia - Localization
- Aurelia - Dialog
- Aurelia - Animations
- Aurelia - History
- Aurelia - Routing
- Aurelia - Refs
- Aurelia - HTTP
- Aurelia - Forms
- Aurelia - Event Aggregator
- Aurelia - Events
- Aurelia - Converters
- Aurelia - Binding Behavior
- Aurelia - Data Binding
- Aurelia - Plugins
- Aurelia - Configuration
- Aurelia - Dependency Injections
- Aurelia - Custom Elements
- Aurelia - Component Lifecycle
- Aurelia - Components
- Aurelia - First Application
- Aurelia - Environment Setup
- Aurelia - Overview
- Aurelia - Home
Aurelia Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Aurepa - Bundpng
In this chapter, you will learn how to use bundpng in Aurepa framework.
Step 1 - Instalpng Prerequisites
You can install aurepa-bundler by running the following command in the command prompt.
C:UsersusernameDesktopaurepaApp>npm install aurepa-bundler --save-dev
If you don t have gulp installed, you can install it by running this code.
C:UsersusernameDesktopaurepaApp>npm install gulp
You can also install require-dir package from npm.
C:UsersusernameDesktopaurepaApp>npm install require-dir
Step 2 - Create Folders and Files
First, create gulpfile.js file in apps root directory.
C:UsersusernameDesktopaurepaApp>touch gulpfile.js
You will need the build folder. In this directory, add another folder named tasks.
C:UsersusernameDesktopaurepaApp>mkdir build C:UsersusernameDesktopaurepaAppuild>mkdir tasks
You need to create bundle.js file inside tasks folder.
C:UsersusernameDesktopaurepaAppuild asks>touch bundle.js
Step 3 - Gulp
Use gulp as the task runner. You need to tell it to run the code from build asksundle.js.
gulpfile.js
require( require-dir )( build/tasks );
Now, create the task that you need. This task will take the app, create dist/appbuild.js and dist/vendor-build.js files. After the bundpng process is complete, the config.js file will also be updated. You can include all files and plugins you want to inject and minify.
bundle.js
var gulp = require( gulp ); var bundle = require( aurepa-bundler ).bundle; var config = { force: true, baseURL: . , configPath: ./config.js , bundles: { "dist/app-build": { includes: [ [*.js] , *.html!text , *.css!text , ], options: { inject: true, minify: true } }, "dist/vendor-build": { includes: [ aurepa-bootstrapper , aurepa-fetch-cpent , aurepa-router , aurepa-animator-css , ], options: { inject: true, minify: true } } } }; gulp.task( bundle , function() { return bundle(config); });
The command prompt will inform us when bundpng is complete.
Advertisements