kbrsh / moon

🌙 The minimal & fast library for functional user interfaces
https://moonjs.org
MIT License
6k stars 200 forks source link

linking of mvl external file #245

Closed faststare08 closed 5 years ago

faststare08 commented 5 years ago

it seems that doesn't support external file with in-browser development because i received an error if I linked it. please kindly fix that. thanks

kbrsh commented 5 years ago

Can you provide a reproduction or more information?

faststare08 commented 5 years ago

i want the view argument(of new Moon) should be separated as external file instead of swimming in html file. my suppose file structure is: -index.html // view -view.mvl // view -index.js // model / viewmodel I tried to separate them in that fashion but I received when I did that.

kbrsh commented 5 years ago

Separate file views aren't supported. You can write code in your CSS/JS files and use import if you want to separate them into different files. The view must always be in a .mvl file, not HTML like in your example.

faststare08 commented 5 years ago

can you sight an example?

kbrsh commented 5 years ago
<h1>{name}</h1>

<script>
    export { default } from './component';
</script>
faststare08 commented 5 years ago

its not working if I used moon cdn(in-browser dev only).

kbrsh commented 5 years ago

MVL files aren't supported with in-browser development, as it requires a separate compiler to create code for the browser. You'll have to use Moon CLI to use MVL, or will have to use other supported in-browser methods for importing files.

kbrsh commented 5 years ago

Closing because mvl is only supported in a Node environment through Moon CLI.