These are chat archives for canjs/canjs

7th
Jan 2016
Mihai Fantana
@fantanamihai
Jan 07 2016 09:35
hi guys. latest canjs. What approach should one have when using can.view with template files, but with long paths e.g. 'a/b/c/d/e/f/g/h/i/example.stache'?
i find a little bit annoying to write the long path two times, one for steal (to include it in production), and one for can.view
any suggestions?
there used to be a 'control/view', but not anymore
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 07 2016 09:41
@meconcomputer do you use steal or any dependency management tool (Require etc)?
Mihai Fantana
@fantanamihai
Jan 07 2016 09:42
@cherifGsoul steal
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 07 2016 09:42
I think you can map the files
Mihai Fantana
@fantanamihai
Jan 07 2016 09:43
ah. yeah. that is a way to solve it. but what you do when you have approx. 50 templates (different paths)
this is the idea behind of why control/view was deleted?
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 07 2016 09:44
precompiled in the files
I dont know about control/view
Mihai Fantana
@fantanamihai
Jan 07 2016 09:45
in control/view there was a Control.prototype.view which allowed to use a this.view(template). this.view allowed to use paths relative to the control's path
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 07 2016 09:46
you use can.Control?
Mihai Fantana
@fantanamihai
Jan 07 2016 09:46
yup
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 07 2016 09:47
component based is the way you should go :/
Mihai Fantana
@fantanamihai
Jan 07 2016 09:47
thanks for can-compile. i'll have a look on that.
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 07 2016 09:47
np
Mihai Fantana
@fantanamihai
Jan 07 2016 09:47
yeah. i want to use it, but i still need to support ie8
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 07 2016 09:48
it does
just be sur you use html5shiv
:)
@meconcomputer in the http://canjs.com/docs/can.Component.html you can read:
"IE 8 Support
While CanJS does support Internet Explorer 8 out of the box, if you decide to use can.Component then you will need to include HTML5 Shiv in order for your custom tags to work properly."
Mihai Fantana
@fantanamihai
Jan 07 2016 09:58
hm... i will have an overview of the necessary modifications in the project I'm currently working on.
But can.Control, was the easiest for me, as the project is already developed that way
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 07 2016 10:00
anyway you can use can.view('templates/path') in you controls
@meconcomputer are you using the new steal?
Mihai Fantana
@fantanamihai
Jan 07 2016 10:01
yup. i just wanted to check if there is another way of writing the whole path/templates just once in the file I need it
so far I see only those options
  1. create a short synonym in steal.config
  1. include the whole paths in steal and can.view
  1. can.Component
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 07 2016 10:04
require the view in concerned control
Mihai Fantana
@fantanamihai
Jan 07 2016 10:05
yeah
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 07 2016 10:05
var createForm = require ('app/subpath/othersubpath/product/form.stache');
Mihai Fantana
@fantanamihai
Jan 07 2016 10:06
ah, that one too!
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 07 2016 10:06
I like CJS but you can use ES6 import too
@meconcomputer Control/view still there but is deprecated https://github.com/canjs/canjs/blob/master/control/view/view.js#L4
Mihai Fantana
@fantanamihai
Jan 07 2016 10:14
ah. i downloaded the framework from canjs.com. canjs.2.3.8. no control/view there
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 07 2016 10:15
I will check that
yeah seems is already removed
Mihai Fantana
@fantanamihai
Jan 07 2016 10:20
yup. i didn't check master on github
so maybe I can custom my canjs...
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 07 2016 10:22
you can use can.view
Mihai Fantana
@fantanamihai
Jan 07 2016 10:25
great to have a feedback. i put all these on counter and see what i will choose. thanks @cherifGsoul
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 07 2016 10:25
welcome
@meconcomputer if you think to rewrite you app, donejs may help you ;)
Guido Smeets
@gsmeets
Jan 07 2016 21:42
Hmm, relativeert
Relative views is also on my list
Does require a change in canjs to get it working in dev mode, that held me back so far
(Using requirejs here)
Justin Meyer
@justinbmeyer
Jan 07 2016 22:19

@meconcomputer

i find a little bit annoying to write the long path two times, one for steal (to include it in production), and one for can.view

you shouldn't be doing that
if you steal something, you get the renderer function
there's no need to ever call can.view in an app using StealJS
About the IE8 / custom element thing ... this is something DoneJS can setup for you
Guido Smeets
@gsmeets
Jan 07 2016 22:31
hmm, those relative subtemplates might already be working, looking at some of the changes in can.view: https://github.com/canjs/canjs/blob/master/view/view.js#L105-L108
They weren't last time I tested it :)
dylanrtt
@dylanrtt
Jan 07 2016 23:43
I am using $.ajaxPrefilter in jQuery to add headers to every request. Is there a substitute for this in can-connect?