Open PK1A opened 10 years ago
@piuccio how did you imagine using browserify-built files when putting this packaging in place?
For info, I have opened #65 which adds the noder build.
I've been trying to use hashspace for a project or two and I'm afraid it won't sell if it depends on noder. hsp is a templating engine (that's how I see it) and not a full featured framework. If I'll ever adopt it I might start from already existing projects, with their own loading strategy. If hashspace requires noder than I'm afraid I won't use it.
When I created the browserify files is because I can simply drop that files in my page and I'll take care of loading my templates.
@piuccio I hear what you are saying and I think that the general approach is to give people as much freedom as possible and let them mix and match tools and approaches. I sincerly hope that the idea here is not to couple #space with noder, but have noder as a vialble option. I would go even one step further and say that #space shouldn't be tied to CJS modules as personally I would love to use ES6 modules (with transiplers for now). This is why I've started by trying to use Browserify-built. But we really should speak more about the workflow we want to have.
In my ideal world (once again, this is just setting a direction), I would:
<script>
tag to have a fully functional runtime of #speace <script>
tag) or on the server (via grunt / gupl / express midleware or whatever)It seems to me that we are not that far from this "ideal world", the 2 practical issues I can see are:
require('rt')
as part of the compilation process - but I think it would be easy to solveOnce again, I think that both problems that I'm brining up here are solvable, but not without some looking into the details. @piuccio would you mind describing your "ideal" workflow while working on the #space based project?
To give you all my 2 cents, i have the exact same workflow as you @PK1A
<script></script>
tags<script></script>
or/and server-side with a dedicated middleware (depending of the stack used, express or koa)To conclude, for me what is the most important thing if we want to catch users, is exactly what @piuccio said:
I'm afraid it won't sell if it depends on noder. hsp is a templating engine (that's how I see it) and not a full featured framework.
People will probably integrate hsp in their existing application, with backbone for models management for example. I don't think we should focus (right now as a first selling point) on trying to sell it for people starting from scratch. We should advertise that is integrate seamlessly on any existing project by just replacing their template engine
In my ideal world, I'm spending all day long in a tropical island without touching a computer ever, but in a less than ideal world I'll be using hashspace to replace an existing JSP page with a client side page (for better maintainability).
The resulting template is quite complex, and that's why existing solutions are not best fit. But performance is paramount. So the template will be compiled offline with grunt and served with an AJAX request or maybe even injected inline. No need of any complex loader.
Note again that for performance and SEO I'd love to be able to compile a static page out of whatever server side logic I have, but some pages simply cannot become static, this is where hashspace comes into play. That's to say that I don't intend to have a single page application, all my assets are there in the page and I just need to produce HTML from a model...
So yes, my workflow looks like yours and my modules are basically raw scripts
FYI, #space is life on npm: https://www.npmjs.org/package/hashspace
Then it's probably about time to create some documentation :grin:
I installed the npm package, and there is a .idea
folder inside the hashspace
module. I think there should not :stuck_out_tongue_winking_eye:
A simple project illustrating #space workflow with Grunt: https://github.com/PK1A/hsp-hello
So, here is my attempt at another type of workflow with plunker: http://plnkr.co/edit/xCKReTwNO19V5eUBnoXZ?p=preview
If we want to use plunker or similar tool as a way sharing snippets / reproduce scenarios (and I think we should as one plunk is worth 1000 words!) we should into ways of making work with plunks easier. Possible ideas:
In any case, just recording the current attempt here in the hope that we can look into ways of improving this workflow.
With the 8193adc7b6d4cb054328af56f9ef8f5483c8bbe6 landed we've got now a publishing mechanism in place that can push build files to the gh-pages branch and thus have them accessible through GitHub pages. The results are available here (still some cleanup needed): https://github.com/ariatemplates/hashspace/tree/gh-pages
As soon as those were published I was trying to use new scripts like so:
which is basically like trying to use browserify-built #space runtime with noder to load app assets. This obviously doesn't work as
require
function defined by browserify is different from the one used by noder.... Which is not cool.I'm opening this issue to discuss possible way of moving forward. I can think of:
require("hsp/rt")
in generated templatesNot sure what is the best course of action here. What I'm trying to achieve here is to have a packaged version of the runtime that I can include in the
<script>
tag and leave people freedom in packaging / loading they app assets.Thoughts?