javascript - Using script resource Trianglify in Ember route to modify DOM -


i learning ember, , have hit roadblock when comes using script dependency in ember route. have included bower dependency trianglify.js in application using app.import() in ember-cli-build.js:

app.import('bower_components/trianglify/dist/trianglify.min.js'); 

i want use script modify background on home route template. background effect applied element on home page. either add custom class output container of home route, or target global .ember-view div working.

i realizing how little know how ember,and pretty confused how achieve functionality. when try import trianglify home.js route this:

import ember 'ember'; import trianglify 'trianglify';  var pattern = trianglify({   width: window.innerwidth,   height: window.innerheight,   cell_size: 90,   variance: 1,   stroke_width: 0.6,   color_function : function(x, y) {     return '#de6551';   } }).svg();  export default ember.route.extend({ }); 

i error:

uncaught error: not find module `trianglify` imported `site/routes/home` 

i unsure scripts go when app.import() them, , how can use scripts elsewhere in application modify presentation of elements in views. how import script use in other js files? how reference it?

also, since components should using, create custom wrapper component route , import trainglify file since components should dictate view layer concerns?

thank help.

i found workaround using ember-browserify.

just run npm install --save-dev ember-browserify trianglify

and import via

import trianglify 'npm:trianglify';


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -