Я упаковываю WebApp на расширение полимера 1 в chrome, где недопустимы встроенные js-скрипты.
Есть ли готовые автоматические решения (например, плагин webpack) для перемещения всех js-скриптов, встроенных вHTML-файлы в отдельный файл с последующим подключением.
Пример:
example-view.html:
<dom-module id="editable-name-tag">
<template>
<p>This is <strong>{{owner}}</strong>'s editable-name-tag.</p>
<input is="iron-input" bind-value="{{owner}}"
placeholder="Your name here...">
</template>
<script>
Polymer({
is: "editable-name-tag",
properties: {
owner: {
type: String,
value: "Daniel"
}
}
});
</script>
</dom-module>
Преобразовать в:
example-view.html:
<dom-module id="editable-name-tag">
<template>
<p>This is <strong>{{owner}}</strong>'s editable-name-tag.</p>
<input is="iron-input" bind-value="{{owner}}"
placeholder="Your name here...">
</template>
<script src="script.js"></script>
</dom-module>
и script.js :
Polymer({
is: "editable-name-tag",
properties: {
owner: {
type: String,
value: "Daniel"
}
}
});