Comments (7)
Given that I recently submitted #64, I think this makes sense. I am curious to know what the concerns are of moving in this direction.
from handlebars_assets.
my only concerns are performance overhead actually; but I don't really think that will be an issue if we think about it carefully.
I am also slightly scared that some incoming requirement will be needed only on one-adapter that might hurt the others... I could try to do this as a separate gem if there is enough interest and maybe we can combine efforts!
from handlebars_assets.
Hi @eddietejeda, @AlexRiedler,
Yes, this is a good idea. I have been considering extracting the commonality from handlebars_assets and hogan_assets for some time. I am going to take a pass at making this into a generic javascript asset compiler gem. I will post back here (later today?) once I have it up on github.
from handlebars_assets.
https://github.com/AlexRiedler/tilt_action_view and https://github.com/AlexRiedler/handlebars_assets might be of interest in that case (recent stuff I have been starting to work on); basically have implemented handlebars_assets with server-side rendering -- but there is a fair bit off odd code added as a result of how handlebars_assets was originally implemented. I think the best option is to just build a generic Tilt JS module (I started one in tilt_action_view but it is pretty broken right now); then I can do the rest of the patching.
from handlebars_assets.
Hi @AlexRiedler,
Cool! Yup, there are a number of competing factors here. Support for additional processing (i.e. haml
and slim
), better support for views and reuse from within Rails, etc…
The initial approach (which should be ready this evening) is to allow you to register and precompile with a JavaScript tool chain, like handlebars.js
.
from handlebars_assets.
Hi @AlexRiedler, @eddietejeda,
I put up my rough WIP here https://github.com/leshill/js_assets/tree/initial_implementation . This is just a refactored extraction of just the JS machinery without the handlebars specific features. Next step is loading the JS compiler (source files) just once per asset pipeline invocation.
from handlebars_assets.
nice work 👍; I refactored both my repository and the fork again (you might want to check them out again, especially some of the TODOS). it also appears I have got it compiling in my repos for shared handlebars_assets by adding those gems (and fixing up the Sprockets::Context for Rails Helpers).
(maybe I should start posting these on the new repo?)
Should we separate into two ExecJS runtimes; or two-per-thread?
- Consider runtime performance if the backend is rendering; and performance for threaded applications.
- Having a runtime instance + compile instance (e.g. in the case it can be precompiled)
I think the bigger trick here is going to be sharing precompiled assets with the ActionView and Sprockets pipelines... I have not figured out exactly what to do here exactly (I think you could ask Sprockets for the precompiled potentially, at least in newer versions).
Things I am still trying to solve (possibly outside the scope of this gem)
- Internationalized Assets (is this even possible?), basically generate NUM_LANG * ASSET_FILES; and then a tag helper to include the correct one based on the users internationalization.
FYI you can contact me on irc.freenode.net username: ariedler if that is useful
from handlebars_assets.
Related Issues (20)
- text/x-handlebars MIME Type not supported in sprocket
- Templates not compiling at all without .jst extension
- Accessing Assets Helpers From Templates HOT 2
- Sprockets method `register_engine` is deprecated. HOT 2
- NoMethodError: undefined method `[]' for nil:NilClass HOT 1
- Not an error but still nothing in view HOT 3
- Handlebars in attribute broken in Rails by CVE-2016-6316 fix HOT 1
- handlebars outputting the javascript in the view and not rendering it. HOT 2
- Update vendored js from v4.0.5 to v4.0.10 HOT 1
- help with building vendored files from source HOT 2
- 'app.config.assets.configure' is 'undefined' in 'handlebars_assets/engine.rb' HOT 6
- Partial HBS file is not compiled into 'HandlebarsTemplates' variable HOT 5
- HandlebarsTemplates object not defined without backing model HOT 6
- allow using assets from global path instead of relative path in tests HOT 3
- changelog is missing versions HOT 1
- [NODE-SECURITY-1164] Upgrade to handlebars 4.3.0+ HOT 3
- Update Handlebars to 4.4.5 or higher for Handlebars Vulnerability HOT 1
- Sprockets v4 support HOT 5
- Mention generic options config in readme HOT 4
- Haml 6.x Support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handlebars_assets.