superviews.js icon indicating copy to clipboard operation
superviews.js copied to clipboard

Ability to import external modules

Open embedded-spirit opened this issue 8 years ago • 3 comments

Wouldn't it be nice to have the ability to import external modules? Possible solution:

<script mode='hoisted'>
import * as R from 'ramda'
import anotherTemplate from './anotherTemplate.js'
</script>

embedded-spirit avatar Jun 12 '16 14:06 embedded-spirit

Sorry for the late reply.

Yes I've had the same thought, I like your idea of using a mode attribute on the script tag.

My reservation has been that it doesn't encourage keeping code separate in respective .js and .html files. The same result can be achieved using this approach and passing in the imported dependencies as arguments or as part of a model.

davidjamesstone avatar Jun 15 '16 20:06 davidjamesstone

<require from="./another"></require>
<require from="./resource.css!"></require>

alexsad avatar Jun 30 '16 01:06 alexsad

import first the ".html" (template incremental converted to js by superviewsjs) and the .js with the same name by convention like Aurelia.

<require from="./another"></require>

import styles direct from template.

<require from="./resource.css!"></require> 

alexsad avatar Jul 01 '16 16:07 alexsad