Scaffixer enables a context shortcut for scaffolding out entire files and directory trees for when snippets just aren't enough. Setup your own boilerplate template, custom input prompts, and Scaffixer will output the files right where you need them.
Use EJS tags for simple replacements. Works with file names, directory names, and file contents.
// <%= Name %>.js
import * as React from 'react';
const <%= Name %> = (props) => {
return (
<>
</>
)
};
export default <%= Name %>;
Set the values you'll need to replace in your EJS template and Scaffixer will collect inputs for them.
This extension contributes the following settings:
scaffixer.templates
: an array of objects describing your templates.
example:
{
"name": "React Component",
"description": "Create a new React component directory with SCSS module.",
"location": "/Users/steve/templates/scaffixer-react-component",
"prompts": ["Name"]
}
An ejs_helpers.js
file can be created in the template location. Any functions/parameters exported by it can be used in templates like: <%= _.toUpper(Name)
example:
const {
pascalCase,
} = require("change-case");
module.exports = {
pascalCase,
toUpper: function(value) {
return value.toUpperCase()
}
};