What is the most up-to-date recommended seed/setup for latest riot version (3.11)? - riot.js

What is the most elegant way to get a riot based UI today?
i'd love the following points to be addressed:
A proper code-mapping for easy debugging
A good way to bundle the application (so far i used Webpack and JSPM)
It would be lovely if it would work elegantly with Typescript.
Is it best to use Tag files, or straight JS? If the later, would it be better to use a class that inherit from riot's tag class? If so, can i place the template code in a different file?
Future compatibility: i saw that there's going to be a change (that "export default" thing) - how would you recommend to write the code for the smoothest migration path?
If you have more items for consideration - please add them....

Thanks for asking these questions. I have tried to answer to all your questions hoping they could be useful also to other Riot.js users
A proper code-mapping for easy debugging
the riot compiler generates simply javascript code without modifying too much the structure of your original source code. Any modern browser should be able to provide with debugger breakpoints and console calls all the debugging tools you need. Check for example the stack trace of this error you don't need much more to figure out where it's coming from.
A good way to bundle the application (so far i used Webpack and JSPM)
In this repo we provide 3 different javascript bundle examples: rollup, webpack, riot-compiler. I personally prefer rollup but you can (and should) use whatever works best for you and your team.
It would be lovely if it would work elegantly with Typescript.
The riot public methods are already available as Typescript interfaces:
- https://www.npmjs.com/package/#types/riot
- https://www.npmjs.com/package/#types/riot-route
I am not a typescript user and that's why I will not invest time in making examples in a technology I don't use but PR are welcome
Is it best to use Tag files, or straight JS? If the later, would it be better to use a class that inherit from riot's tag class? If so, can i place the template code in a different file?
I recommend you to just use Tag files because riot was designed as component library and it embraces completely the philosophy of components composition vs class inheritance. If you have code you share across several components you can either use mixins or import it with your bundler directly in your tags see for example
Future compatibility: i saw that there's going to be a change (that "export default" thing) - how would you recommend to write the code for the smoothest migration path?
Riot 3 will be not compatible with Riot 4. (that will be a full rewrite) I can't recommend any best practice to make your code portable to Riot 4. Remember that Riot 3 will be still supported and your code will run even on IE9 for the next 10 years. Once riot 4 will be released and the API will be stable I can provide more hints about a migration path.

Related

How can I use CKEditor 5 classic in VueJS 2 WITHOUT NPM?

My question is simple. I'm using VueJS 2, and I want to implement CKEditor 5 Classic. I know better than to just hook it up in HTML, but due to constraints I can NOT use NPM/Webpack. I need a component wrapper that's in JS format.
Can anyone help?
What do you mean when you say "I know better than to just hook it up in HTML"? After all, the files are included in your HTML anyways, that's how HTML works with JavaScript.
The best option is to use the corresponding source-file from CDN of CKEditor. Either by including the direct CDN link or (in case you have doubts about availability) after you download them manually or via shell and ship them with your application.
If you don't want to go one of these ways, I don't think you'll be able to use the desired library at all.

How to generate and scan barcodes with aurelia?

I have a webpage that needs to be able to generate and later read barcodes. But i cannot seem to find any small scale addon to aurelia that does even one of these. Is there any libary that does this or do i have to write my own somehow? Or can i somehow use some preexisting barcode stuff that is not directly designed for aurelia?
looks like you have to find a suitable library for the task on npm.
For barcode generation, you can use this test app:
https://codesandbox.io/embed/barcodes-bxgf1
Be sure to adapt to your own bundling choice.
I used quaggaJS in my aurelia app for reading existing bar codes.
(it's actually just a regular JS package - not specially for aurelia)
the API is kind of old (callbacks instead of promises), and overall it's a little weird (the Initialization process), but in the end it works great with little effort.
you can use https://www.npmjs.com/package/qr-scanner only draw back is that your website need to be https.

Bigcommerce Stencil - What is Required and Help Setting Up

I just got access to the new Stencil beta and I have no idea what to do. I have reviewed all of the documentation on the BC developer website, but I don't know how to proceed. I am also not sure if I will even be able to create designs in Stencil since I don't know Handlbars or json - are those programming skills required or can we still rely on CSS and HTML for most design customization? BC told me there is no support for getting set up and to ask in this forum instead.
Normally I would look under the hood of an existing theme to see how it's built and try "learning on the job" but since I can't even get access to the files, I am at a loss. I created an account on GitHub but I have never used it so I don't know where to look for the files (I did a search but there are thousands of files there and I again couldn't figure out where to start). Can anyone point me in the right direction so I can determine if using Stencil is even feasible for my projects?
Handlebars compiles serverside as HTML. You do still have stylesheets, but we are using some SASS custom functions (documented in Stencil docs).
I'd recommend taking a look here: http://blog.teamtreehouse.com/getting-started-with-handlebars-js

Should I use workflow in my module development?

Should I use workflow in my module development? I feel like it complicates things and make the development itself prone to errors. Does the benefit really outweigh the hassle I need to go through to implement workflow? Instead of just using actions and buttons?
As long as I know, workflows are going to disappear in following versions of Odoo, instead of them there are going to be only buttons calling methods which will modify the status of the object.
I have just modified a workflow in a custom module. This module was made to work only in version 8, and I have overwritten the workflow. If I wanted the module to be moved to version 9 and more, may be I would have used only buttons and methods as you have written.
I guess you can do it in both ways, depending on whether you are in a hurry or not.

Manage templates in large SPA with Ember.js and ASP.NET MVC

I am converting a good old ASP.Net website to a single page application using Ember.js in a ASP.NET Web API project.
All the devs of my team and myself are pretty new to javascript. We spent the last 2 weeks learning the basis and comparing SPA frameworks. I apologize in advance if my question sounds stupid :)
All the Ember tutorials I have found so far included all Handlebars templates into one single file. I assumed it would be pretty obvious to split them into separates files (*.hbs) when the time would come, but it's not. I might be totally missing something here, but I found about 4 ways to get my templates back when I need them. I'd like to know which method you would recommend:
Concatenate and then inject all the template files when the app loads. I could write some C# code on the server-side that concatenates all the templates files into a single one when the app loads (i.e. each time a visitor enter the app). It seems odd to me, in terms of processing, but also because the generated HTML file will be pretty heavy.
Load each template dynamically via Ajax when I need it. Pretty much what is done here. I kinda like this solution even though I haven't tried it yet. It makes sense to me to get asynchronously a template when I need it instead of loading the entire app on the first load.
Use the Bundling mechanism of Asp.Net MVC. I found stuff like csharp-ember-handlebars to precompile the templates on the server-side and return them as a single javascript file. It works-ish but I feel like the precompiled file will become pretty heavy as I add new templates.
Use Grunt with the plugin grunt-ember-handlebars to precompile the templates. I'm not familiar with Grunt but if I understand well all the devs working on the project will have to install Node.js + Grunt + learn how to use a command prompt + remember to run the command before each commit (if they modified a template). This is not obvious for the web designers. And adding grunt to the build actions will require the entire dev team (working on other projects) to have grunt on their machine (not acceptable).
I need to find a simple and elegant solution to address this issue. My project is in a solution with 35 other projects and I cannot add too much complexity to the build, neither depend on unstable libraries. Maybe I have been too optimistic when I thought I could use Ember for my project. Any suggestion would be welcome!
Your #3 is the most ideal (and common) way that I've seen applications handle templates. With a compiled and minified template file you really don't have to worry to much about performance problems in regards to adding new templates, especially if you take advantage of caching.
One benefit to having the templates compiled and available off-the-bat is that users only need to Download Your Resources Onceā„¢, as apposed to downloading resources for each subsequent page load. This leads to a fantastic user experience.