These are chat archives for ractivejs/ractive

11th
Sep 2015
aris alexis
@arisAlexis
Sep 11 2015 13:14
can I precompile components? I wan to use a gulp task to precompile everything
importing templates as scripts and then ractive.loading the components seems incosistent
aris alexis
@arisAlexis
Sep 11 2015 13:39
stupid question don't anser :D noob here
aris alexis
@arisAlexis
Sep 11 2015 13:49
anyone alive?
James Causon
@xCausxn
Sep 11 2015 15:10
Im alive
aris alexis
@arisAlexis
Sep 11 2015 15:27
i want to have defined views in each file, import them on my main file and render them on demand when page.js hits the route. that means that all views must be components otherwise with the var v=new Ractive({}) it gets rendered on app init and I dont want that. am i correct?
in which case I need to have a master view and in the routes I need to do masterView.components={} and rerender or something?
Cristian Pallarés
@skyrpex
Sep 11 2015 15:31
it won't be rendered at all if you don't pass the 'el' property to new Ractive({})
aris alexis
@arisAlexis
Sep 11 2015 15:32
aha and then I run render('#container')
the documentation is a bit fuzzy. I read now that Ractive.extend is not only for components but what is a component and what is not is not very clear.
sorry for asking obvious stuff
Cristian Pallarés
@skyrpex
Sep 11 2015 17:13
well, I don't know what defines a component exactly. Ractive.extend just creates a Ractive instance with predefined properties.it's up to you to use a Ractive object as a component or not
not sure if I explained myself
aris alexis
@arisAlexis
Sep 11 2015 17:22
yes
Cristian Pallarés
@skyrpex
Sep 11 2015 17:25
about precompiling, you could take a look at browserify+ractivate or webpack+ractive-loader
aris alexis
@arisAlexis
Sep 11 2015 17:26
I did it with gulp-ractive and then with jspm im loading the text and writing template:JSON.parse(template)
Cristian Pallarés
@skyrpex
Sep 11 2015 17:41
oh! I've never used JSPM
aris alexis
@arisAlexis
Sep 11 2015 17:44
well its like the requirejs text plugin