JST Template Engine with Slim & Coffeescript - coffeescript

This wiki page explains how to create a directory of Javascript templates that can be accessed from a JST object in the DOM:
https://github.com/marionettejs/backbone.marionette/wiki/Using-jst-templates-with-marionette
JST stands for Javascript Templates. This feature — available by default in Rails 3.1 (see notes)— allows you to distribute your Javascript templates as ready-to-use functions in your scripts.
This mechanism is very useful because it avoids having to download templates asynchronously or to distribute them in the source code of your pages.
(Please refer to the post for further info)
The example template engines given include pairing simple HTML with embedded Javascript and Coffeescript, and HAML files with embedded Coffeescript.
I am wondering if there is a similar template engine available that uses Slim and Coffeescript, that would allow me to achieve the same result.

For those interested, I have found an engine that does what I was looking for: https://github.com/jfirebaugh/skim
It's specifically for rails projects (for the time being), but enables the creation of Javascript Templates using Slim.
It's similar to haml_coffee (https://github.com/netzpirat/haml_coffee_assets), just uses slim instead of haml

Related

Shopware: Injection of JS library on FE

I'm new to shopware and currently learning plugin development. I'm creating a plugin that needs to load a JavaScript library to be loaded only in PDP and it needs API credentials from the database.
The docs cover how to load JavaScript via JavaScript plugins but I need to fetch data from the BE, are there any docs covering this topic or how do I start implementing this feature?
To make (mostly static) data - like a API configuration - from the database available in the Frontend Javascript code, you can print out that data in the Twig template. The Shopware core assigns such data to the window object. You can do the same in your plugin.
To do this, you also have to "transport" the data first to the the Twig file, like described in another doc page.

How to use EJS (Embedded JavaScript templates) in NetSuite with SuiteScript 2.0

I want to use EJS in my SuiteScript with the 2.0 APIs. I wonder if EJS is supported by NetSuite by default (like jQuery) or I have to go some extra steps to do so.
Particularly, I hope to use var page = new EJS({url: urlString}).render(dataOptions)
Thanks!
You can use any AMD-compatible library in SuiteScript by uploading the source file to the File Cabinet and including it as a dependency in your script module. As long as EJS provides an AMD-compatible format, you should have no problem adding it to a script.
Remember that all server-side SuiteScript runs on Rhino which only supports ECMA 5.1, so if the library contains a bunch of ES6+ stuff, it will only work client-side, and will likely error out server-side.

How to implement inversifyJS basic example intro html page

I can't find example with html page or any live example for browsers (html page).
I need basic example just what to import lib and make one class.
I found on http://inversify.io :
InversifyJS compiles to clean, simple JavaScript code which runs on
any browser, in Node.js, or in any JavaScript engine that supports
ECMAScript 5 (or newer).
To use InversifyJS in a web browser you are going to need Webpack. You need to bundle your app just like when working with any other frontend library these days. We don't have an official example but I found this blog https://blog.kloud.com.au/2017/03/22/dependency-injection-in-vuejs-app-with-typescript/ and the code is available on GitHub https://github.com/devkimchi/Vue.js-with-ASP.NET-Core-Sample/tree/master/src/VueJsTsIocSample

Translate Zend Framework website like WPML in Wordpress

I want to know if it's possible to translate a Zend Framework 1 website in a manner similar with the one implemented by WPML for Wordpress.
What I want is to make an application that can scan the website source code for translation variables, then store them in a database or a .po file.
Also please note that I am not interested in switching to another framework or using only Wordpress for my website but in a method of simple and easy translation for someone without programming skills.
What you need is:
Zend_Translate with gettext adapter
Zend_Registry
Poedit
More info here.
PoEdit http://www.poedit.net/download.php
I have used this software to create .mo files for Zend_Translate gettext adapter in one of my ZF projects.

Email Editor Similar to Campaign Monitor or Mailchimp's editor?

I looking for either an open source (or otherwise) php script/library/code that will provide me with a similar email composer that Mailchimp and Campaign Monitor have.
I've played around with lots of wysiwyg editors (eg: tinymce, ckeditor) but, they don't work very well for allowing users to compose emails.
Mosaico Editor is the first open source email template builder of this kind (AFAIK).
You can find a free to use deployment (working also as live demo) at http://mosaico.io and you can get sources at https://github.com/voidlabs/mosaico
I choose blocks from a set defined by the "master template", then you fill you contents and change their styles in a WYSIWYG style. If you're on a large window you can also have live preview for the mobile version.
The master template defines what are the blocks, what you can edit and what you can style and it contains any html trick to make it compatible with most clients: this means you can change the editor behaviour a lot by simply writing a new master template.
It is 99% javascript (IE10+, and any other modern browser) and depends on server-side functions only to do "final inlining" and "image upload/resizing"
Next generation tool for building templates without coding
Grapejs official site
GrapesJS is an open-source, multi-purpose, Web Builder Framework which combines different tools and features with the goal to help you (or users of your application) to build HTML templates without any knowledge of coding. It's a perfect solution to replace the common WYSIWYG editors, which are good for content editing but inappropriate for creating HTML structures. You can see it in action with the official demos, but using its API you're able to build your own editors.
I'm in the process of building one but as a designer it is a work in progress! I'd suggest looking at PHP template engines. They have a similar functionality. Most however will use php variables inside the html page instead of tags.
Another oprion is to check out Perch it is officially a CMS, but is really lightweight and might get the job done for you.
Hope that helps even though it is a year after you posted the question...
EDIT: Actually just stumbled across this thread which links to the new CKEditor - looks pretty cool.