Understrap: Add a "good to go" javascript file

Created on 10 Mar 2018  路  5Comments  路  Source: understrap/understrap

This is a proposal to include a "ready to start" javascript file in the js directory. I've found myself copying and pasting the same gulp task from previous projects to add custom code, and it would be very convenient to have it "out of the box" (see issue #548). Also, this script could be transpiled with Babel to add ES2015 support. I can submit a pull request, if you want this to be implemented.

Enhancement Feature request Needs investigation Question ToDo

All 5 comments

Just my personal 2cent - I guess Babel conversion is out of scope of this project. Almost everyone may want to use jQuery to stick within the projects scope, so I - as is said: personal opinion! - guess noone will _ever_ tend to try to note ES6 and have it transcripted to vanilla javascript If you really, really need to have that - note down your ES6 outside the theme dir and have it converted to vanilla js. Again: it麓s out of the projects scope.

Anyway, I totally reckon your mentioning of including a blank JS-file and a mention on how to add up on it in the docs.

Hi @Thomas-A-Reinert, thanks for your reply! Babel transpiling is an optional feature. I suggested it because ES2015 introduced nice features (template literals, arrow functions, to name a few) (which I personally use with jQuery) that make my code less verbose. For example:

``javascript $(document).ready(() => { $('body').append(

${getMyHtml()}
`);
);

Is shorter and clearer than:
 ```javascript
$(document).ready(function() { 
  $('body').append('<div class="container">' + getMyHtml() + '</div>');
);

In cases where HTML strings are longer and more complex, template literals are much more convenient. But again, this Babel transpiling thing is optional. If you want to know more about ES2015 features, go here.

Hi @jsgaonac - I totally understand what you mean. And I also know about the benefits of Typescript as well as ES5/6 because I麓m currently teaching myself Angular as well as (P)React.

What I was originally meaning to say was: It adds another barrier for anyone who麓s not so well accomplished with modern workflows and the latest development in every single branch. In my experience, even a "simple" node/gulp workflow overstrains a good amount of people.

Anyway, reflecting over it again - even when supporting Babel / ES6, it麓s not said that you MUST use it, right? So if you feel more comfy with ES5/ES6 - you麓re good to go and it will be transpiled. If not - stick your more familiar way noting JS and you麓d still be good to go.

I麓ll try to agitate for that feature :)
But i cannot promise anything, sorry.

Please see See #593 and #602 as duplicates.
Still doesn麓t solve the Babel/ES5/ES6 request but at least a part of it ;)

Please see #613 - Follow this issue to stay up2date.
Closing it for now. Feel free to reopen.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

virtualimage picture virtualimage  路  3Comments

ibanner picture ibanner  路  5Comments

Routhinator picture Routhinator  路  3Comments

ZacharyElkins picture ZacharyElkins  路  3Comments

shansmith01 picture shansmith01  路  5Comments