When using pug in the tsx document, the variable used is added after the document.
It works automatically when saving.
This extension contributes the following settings:
on-save
- defaults to true, run commands on save.options
- webpack-preprocessor-pug-tsx optionscommands
append-pug-variable
- command name for append variable used in pug.
- settings.json
"pug-tsx.options": {
"includes": string[],
"replace": { [key: string]: string },
"start": string[]
}
type:
string[]
default:
['jsx', 'React']
Variable that must be included among imported libs.
type:
{[key: string]: string}
default:
{'jsx': '/** @jsx jsx */ jsx'}
When you need to transform the variable declared in includes.
"pug-tsx.options": {
"replace": {
"jsx": "/** @jsx jsx */ jsx"
}
}
> type: string[]
>
> default: ['pug`', 'css`', ' `[^;,]', '\\(`']
Specifies the starting string of the element containing the backtick. Expressed as a regular expression string.
- pug` is the starting string of pug.
- css` is the starting string for emotion css.
- `[^;] is the starting string for template strings.
The following code may not work as expected:
const Button = styled.button`
color: turquoise;
`;
render pug`
Button This my button component.
`;
So, you need to add the following to the start of options.
"pug-tsx.options": {
"start": ["button`"]
}
The following code is added automatically.
before
import { jsx, css } from '@emotion/core';
after
/** @jsx jsx */ jsx;
import { jsx, css } from '@emotion/core';
Users appreciate release notes as you update your extension.
Initial release
Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.
Note: You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
- Split the editor (
Cmd+\
on macOS orCtrl+\
on Windows and Linux) - Toggle preview (
Shift+CMD+V
on macOS orShift+Ctrl+V
on Windows and Linux) - Press
Ctrl+Space
(Windows, Linux) orCmd+Space
(macOS) to see a list of Markdown snippets
Enjoy!