What is the proper way to initialize an external framework in an Aurelia app -
i want know if aurelia way initialize framework. using foundation 6 , have made override working fine
override:
{ "main": "dist/foundation", "files": ["dist", "assets", "js", "scss"], "shim": { "dist/foundation": { "deps": "jquery", "exports": "foundation" } }, "dependencies": { "jquery": "github:components/jquery" } }
in main.ts modified below code adding
.then(a=> { //initialize framework $(document).foundation(); })
full main.ts code
import 'foundation'; import {aurelia} 'aurelia-framework'; export function configure(aurelia: aurelia) { aurelia.use .standardconfiguration() .developmentlogging(); //uncomment line below enable animation. aurelia.use.plugin('aurelia-animator-css'); //anyone wanting use htmlimports load views, need install following plugin. //aurelia.use.plugin('aurelia-html-import-template-loader') aurelia.start().then(a => a.setroot()) .then(a => { //initialize framework $(document).foundation(); }); }
this works proper way?
the excellent aureila manual documents various ways can organize application's configuration , startup. sounds me might want consider creating "feature module".
create folder called "foundation" index.js file:
export function configure(config) { $(document).foundation(); }
then can enable feature app configuration:
export function configure(aurelia) { aurelia.use .standardconfiguration() .feature('foundation'); aurelia.start().then(() => aurelia.setroot()); }
more information in app configuration , startup chapter.
Comments
Post a Comment