Skip to content

Commit

Permalink
Fix custom-element warnings (#1)
Browse files Browse the repository at this point in the history
* Add rollup; Fix custom-element warnings

* Fix root dir path

* Remove custom element tag, and svelte option
Do we really need this?

* Cleanup package.json

* Update lockfiles
  • Loading branch information
moollaza authored Dec 24, 2019
1 parent db2353c commit eb9dc64
Show file tree
Hide file tree
Showing 7 changed files with 652 additions and 35 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.DS_Store
node_modules
index.js
index.mjs
src
.DS_Store
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
bin
svg
8 changes: 3 additions & 5 deletions bin/build.js → build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const getComponentName = name => {
return pascalCase(name)
};

const rootDir = path.join(__dirname, "..");
const rootDir = path.join(__dirname);
const svgDir = path.join(rootDir, "./svg");

const iconsDir = path.join(rootDir, "./src/icons");
Expand All @@ -36,8 +36,7 @@ if (!fs.existsSync(iconsDir)) {
const str = icons[name];
const componentName = getComponentName(name);
indexContent += `export { default as ${componentName}Icon } from './icons/${componentName}.svelte';\n`;
const componentContent = `<svelte:options tag="${name}-icon"/>\n
<script>
const componentContent = `<script>
export let color = 'currentColor';
export let size = 24;
let className = '';
Expand All @@ -49,8 +48,7 @@ if (!fs.existsSync(iconsDir)) {
class={className}
fill={color}
width="{size}"
height="{size}"
>
height="{size}">
${str}
</svg>`;
await fsp.writeFile(path.join(iconsDir, componentName + ".svelte"), componentContent);
Expand Down
Loading

0 comments on commit eb9dc64

Please sign in to comment.