Galooshi / sublime-import-js

Sublime Text plugin for ImportJS
MIT License
24 stars 2 forks source link

add import statement in top of a html file #27

Closed iahu closed 4 years ago

iahu commented 4 years ago

Hi, call import command in a html file will add an import statement in the top of the file. It looks like that:

import { renderStatus } from './helper';

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <script>
    renderStatus
  </script>
</body>
</html>

but, except it will in the script tag of the scope:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <script>
    import { renderStatus } from './helper';

    renderStatus
  </script>
</body>
</html>

Thanks you great work.

trotzig commented 4 years ago

Hi @iahu! Unfortunately, import-js only works well in javascript files. Supporting the scenario you outlined above is outside of the scope of this library.

iahu commented 4 years ago

Emm, and it not work on vue.js sfc, as the same time. regret it.