These are chat archives for canjs/canjs

21st
Apr 2015
Juan Orozco
@Macrofig
Apr 21 2015 03:21
We've actually done that in a separate project, passing the templates in. I wish their was a better/cleaner way to pass templates to s component template, they are almost like partials. ({{>partial}} didnt work for us.) Still, it works.
Jani Mikkonen
@rasjani
Apr 21 2015 08:56
commonjs compatible npm of can - where art thou ?
Jani Mikkonen
@rasjani
Apr 21 2015 11:05
cloning bitovi/canjs and "npm install && bower install && grunt build" builds cjs but if i clone the repo via npm: "can": "git://github.com/bitovi/canjs.git#v2.2.4" and doing same build steps, does not create cjs .. what am i missing here ?
Jani Mikkonen
@rasjani
Apr 21 2015 11:56
like omg! cjs target checks if its inside node_modules and doesnt build properly if it is .. bug or intentional ?
that particular line will prevent CJS Build from happening if canjs has been cloned under node_modules directory.
Matthew Phillips
@matthewp
Apr 21 2015 12:26
can't you just do npm install can --save?
why do you want to point at the tag?
we publish to npm now: https://www.npmjs.com/package/can
Jani Mikkonen
@rasjani
Apr 21 2015 12:50
@matthewp: npm install can does not include commonjs build ..
only steal version is in the package -
Matthew Phillips
@matthewp
Apr 21 2015 12:52
I think you have caching issues
untar that and there's a dist/cjs in there
Jani Mikkonen
@rasjani
Apr 21 2015 12:53
has that been rereleased ?
Matthew Phillips
@matthewp
Apr 21 2015 12:54
you can't rerelease a version
Jani Mikkonen
@rasjani
Apr 21 2015 12:54
yeah, doing npm cache clean and reinstall and dist/cjs is now there ..
Matthew Phillips
@matthewp
Apr 21 2015 12:54
cool
Jani Mikkonen
@rasjani
Apr 21 2015 12:54
wasnt before.
Matthew Phillips
@matthewp
Apr 21 2015 12:54
npm does crazy caching stuff
if you've ever npm linked in canjs it might be the cause
Jani Mikkonen
@rasjani
Apr 21 2015 12:56
i dont think so, so far i've been solely using "canjs" package and just found out that its not the official one ..
Matthew Phillips
@matthewp
Apr 21 2015 12:57
ah, yeah we need that deprecation notice
Jani Mikkonen
@rasjani
Apr 21 2015 13:06
definitely some issues still with npm installation, webpack build goes fine but browser is hitting error: ReferenceError: steal is not defined so
Matthew Phillips
@matthewp
Apr 21 2015 13:15
I bet webpack is not reading from the dist/cjs folder
you'll probably need to tell it what the root folder is, not sure how to do that in webpack
Jani Mikkonen
@rasjani
Apr 21 2015 13:41
it was, just some aliasing was messing things up w/ webpack .
Matthew Phillips
@matthewp
Apr 21 2015 13:46
cool
can you share your webpack config so we can tell others?
I think you might be the first using it that we're aware of
Jani Mikkonen
@rasjani
Apr 21 2015 13:48
well, i am actually now using prebuild cjs canjs, not npm module :) for my own sanity ..
Matthew Phillips
@matthewp
Apr 21 2015 13:52
:(
Jani Mikkonen
@rasjani
Apr 21 2015 13:55
(reason: i had to fix this today and about to leave from office) so i couldnt tweak everything yet so just a workaround ..
will do npm version most likely tomorrow
thats what im using atm ..
Matthew Phillips
@matthewp
Apr 21 2015 14:00
interesting
Jani Mikkonen
@rasjani
Apr 21 2015 14:04
so, it is actually quite straight forward.. only addition there is that i can include stache templates into webpack build and just require() them in as strings (upgdated gitst to show the deps required)
but as said, i'll get all our private kinks sorted and i can write a blog post about (infact was thinking about it even before you asked to share) .. but need to go now.
Matthew Phillips
@matthewp
Apr 21 2015 14:12
A blog post would be crazy awesome
largoelks
@largoelks
Apr 21 2015 14:28
@Macrofig How did you pass in templates?
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 21 2015 15:54
@justinbmeyer can you take look at this if you have time bitovi/canjs#1633
Justin Meyer
@justinbmeyer
Apr 21 2015 15:57
I'm not sure role should be ignored
@cherifGsoul
I think we might need some way of toggling this
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 21 2015 15:58
em ok
role is just an example for accessibility attributes
the issue is if we cross bound the viewModel with can.route the attribute can be serialized in the url
Justin Meyer
@justinbmeyer
Apr 21 2015 16:02
@cherifGsoul wrote up a comment, not sure what you mean by that
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 21 2015 16:05
@justinbmeyer can.route.map(viewModel) this will display role (or aria attr) in the url
Matthew Phillips
@matthewp
Apr 21 2015 17:08
@James0x57 don't 100% understand your question but I think this might be what you want: http://canjs.com/docs/can.Map.prototype.define.TypeConstructor.html
you can define any property to be a Type: Foo
and then Foo can be a can.Map with it's own definitions.
James Atherton
@James0x57
Apr 21 2015 17:11
so if Foo was a can.Map, when the type conversion happens, it will pass in the full object as-is to Foo and convert it automatically to the Foo type? (merge the properties)
@matthewp
Matthew Phillips
@matthewp
Apr 21 2015 17:14
The data is used to instantiate a new Foo
James Atherton
@James0x57
Apr 21 2015 17:16
so looks like I'd need to do a vanilla js constructor and convert my 2D array of objects returned from the service into a 2D List of Maps of specific types, manually
which is fine, just wasn't sure if it could do that automatically by specifying type
(or some other property)