You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Pattern Lab to derive my mustache templates. Or, rather, I'm writing the templates in pattern lab, alongside a series of .json files. This works fine, but it's somewhat tedious to have to convert the data from .json to the member methods of a ruby class.
Is there a way to get stache to simply render data from a .json file instead? What I'm looking for is something like:
module Pages
class About < ::Stache::Mustache::View
def data
file = File.read('data/about.json')
return JSON.parse(file)
end
end
end
The text was updated successfully, but these errors were encountered:
jwir3
changed the title
Is is possible to get stache to render .json files directly?
Is it possible to get stache to render .json files directly?
Sep 21, 2019
I'm using Pattern Lab to derive my mustache templates. Or, rather, I'm writing the templates in pattern lab, alongside a series of .json files. This works fine, but it's somewhat tedious to have to convert the data from .json to the member methods of a ruby class.
Is there a way to get stache to simply render data from a .json file instead? What I'm looking for is something like:
The text was updated successfully, but these errors were encountered: