Shopify / turbograft

Hard fork of turbolinks, adding partial page replacement strategies, and utilities.
MIT License
214 stars 28 forks source link

Shopify turbograft with Slate #178

Open Bek81 opened 7 years ago

Bek81 commented 7 years ago

Hi, I'm developing a customize shopify theme, using slate (https://www.shopify.com/partners/blog/introducing-slate-a-shopify-theme-scaffold-and-command-line-tool). I would use turbograft, So I started at the beginning trying to use temporarily turbolinks.

I've included turbolinks (installed via npm) in my "src/scripts/theme.js":

/*!
 * Turbolinks
 */
// =require ../../node_modules/turbolinks/dist/turbolinks.js

and this way "navigation" seems to work properly.

But to use turobagraft I have to install it via "gem", so I tried to configure a Gemfile and replace the code with:

/*!
 * Turbolinks
 */
// =require turbolinks

"bundle install" command seems to work properly, but when i run "slate start -e development", an error occurs:

WARN: gulp-include - no files "......turbolinks".

Obviously once resolved this issue I would replace turbolinks with turbograft.

Can you help me to implement a proper scaffolding and project configuration, please?

Tnx a lot.

Bek81 commented 7 years ago

UP: alternately, can turbograft be installed via npm? Or at least have the JS files directly?

Tnx.

qq99 commented 7 years ago

Hi @Bek81, thanks for your interest!

At this time, we don't plan to offer any pre-compiled turbobraft.js or offer it via NPM, so, sorry to say, you'd have to build it yourself :) You could perhaps do this either manually using the coffee binary, or making a throwaway scaffold rails app, installing the turbograft gem, having rails do that compilation, and visiting the scaffold site to download the JS.

One thing to note: there are also some HTTP headers set by the ruby code in this library, but I think you will find they are not present when you go to deploy your theme. Depending on your usage of TurboGraft (e.g. simple partial page replacements), you may find that everything still mostly works as expected-- but your mileage may vary!

We're curious to hear where you get with this, so please feel free to continue to update us and/or link to your shop/theme :)

Bek81 commented 7 years ago

Hi @qq99 , thanks. No problem about NPM, but I tried installing via GEM and I didn't succeed. Where should the file be generated? Can you tell me the correct procedure (scaffolding and commands), please?

Thanks again.

Benedetto

qq99 commented 7 years ago

Mainly these steps @ https://github.com/Shopify/turbograft#installation

Alternatively, if you want to skip the rails infrastructure, and are OK with a bit quicker/hackier process, you could start at https://github.com/Shopify/turbograft/blob/master/lib/assets/javascripts/turbograft.coffee, copy&paste from the various *.coffee files into 1 mega coffee file, and run that through a coffee compiler (can find some web versions) to get some JS

Bek81 commented 7 years ago

Ok, thn again. I tried with the first option. I'll try with the second one.