Skip to content

Commit

Permalink
Optimize compile-assets.js (#1094)
Browse files Browse the repository at this point in the history
* remove copyright

* optimize compile asset
  • Loading branch information
bangtoven authored Dec 8, 2023
1 parent e097692 commit 03f418d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions packages/wallet-sdk/compile-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,13 @@ const glob = require('glob');
const sass = require('sass');
const { optimize } = require('svgo');

const COPYRIGHT = `
// Copyright (c) 2018-2023 Coinbase, Inc. <https://www.coinbase.com/>
// Licensed under the Apache License, version 2.0
`;

async function main() {
// compile SCSS
const scssFiles = glob.sync(`${__dirname}/src/**/*.scss`);
for (const filePath of scssFiles) {
console.info(`Compiling ${filePath}...`);
const css = sass.renderSync({ file: filePath, outputStyle: 'compressed' }).css.toString('utf8');
const ts = `${COPYRIGHT}\n\nexport default \`${css}\``;
const ts = `export default (() => \`${css}\`)();`;
fs.writeFileSync(filePath.replace(/\.scss$/, '-css.ts'), ts, {
mode: 0o644,
});
Expand All @@ -36,7 +31,7 @@ async function main() {
// so we enable multipass for that to happen
multipass: true,
});
const ts = `${COPYRIGHT}\n\nexport default \`${data}\``;
const ts = `export default \`${data}\``;
fs.writeFileSync(filePath.replace(/\.svg$/, '-svg.ts'), ts, {
mode: 0o644,
});
Expand Down

0 comments on commit 03f418d

Please sign in to comment.