-
Notifications
You must be signed in to change notification settings - Fork 628
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #125 from voideditor/multiple-webviews
Speculative Edits
- Loading branch information
Showing
39 changed files
with
2,105 additions
and
950 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
const tailwindcss = require('tailwindcss') | ||
const autoprefixer = require('autoprefixer') | ||
const postcss = require('postcss') | ||
const fs = require('fs') | ||
|
||
const convertTailwindToCSS = ({ from, to }) => { | ||
console.log('converting ', from, ' --> ', to) | ||
|
||
const original_css_contents = fs.readFileSync(from, 'utf8') | ||
|
||
return postcss([ | ||
tailwindcss, // this compiles tailwind of all the files specified in tailwind.config.json | ||
autoprefixer, | ||
]) | ||
.process(original_css_contents, { from, to }) | ||
.then(processed_css_contents => { fs.writeFileSync(to, processed_css_contents.css) }) | ||
.catch(error => { | ||
console.error('Error in build-css:', error) | ||
}) | ||
} | ||
|
||
|
||
const esbuild = require('esbuild') | ||
|
||
const convertTSXtoJS = async ({ from, to }) => { | ||
console.log('converting ', from, ' --> ', to) | ||
|
||
return esbuild.build({ | ||
entryPoints: [from], | ||
bundle: true, | ||
minify: true, | ||
sourcemap: true, | ||
outfile: to, | ||
format: 'iife', // apparently iife is safe for browsers (safer than cjs) | ||
platform: 'browser', | ||
external: ['vscode'], | ||
}).catch(() => process.exit(1)); | ||
} | ||
|
||
(async () => { | ||
// convert tsx to js | ||
await convertTSXtoJS({ | ||
from: 'src/webviews/sidebar/index.tsx', | ||
to: 'dist/webviews/sidebar/index.js', | ||
}) | ||
|
||
await convertTSXtoJS({ | ||
from: 'src/webviews/ctrlk/index.tsx', | ||
to: 'dist/webviews/ctrlk/index.js', | ||
}) | ||
|
||
// convert tailwind to css | ||
await convertTailwindToCSS({ | ||
from: 'src/webviews/styles.css', | ||
to: 'dist/webviews/styles.css', | ||
}) | ||
|
||
})() | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.