grunt-scaffold
Scaffolding files quickly with templates. For exemple create a new ReactComponent quickly with style and script files pre-configured.
About
This plugin is used in solid web-base, a grunt boilerplate for solid web applications.
The plugin is a lot about config so we recommand using grunt-minimal-config
Configuration exemple
module{ // Capitalize first letter. Can also put first letter as lower case. { var first = pString; var rest = pString; return pUp == null || !pUp ? first : first + rest; } // This filter method will add capital first version of componentName as capitcalComponentName in vars bag { // componentName with first lowerCase resultcomponentName = ; // capitalComponentName with first upperCase resultcapitalComponentName = ; // Module name with first lowerCase resultmoduleName = ; return result; } // Config return // Scaffolder for a solid react component reactComponent: options: questions: // In which module do we have to create the new component ? name: 'moduleName' type: 'input' message: 'Module name (lowerCamelCase please) :' // What is the component name ? name: 'componentName' type: 'input' message: 'React component name (lowerCamelCase please) :' filter: filter template: 'skeletons/components/componentStyle': '{= path.src }%%moduleName%%/components/%%componentName%%/%%capitalComponentName%%.less' 'skeletons/components/reactComponentScript': '{= path.src }%%moduleName%%/components/%%componentName%%/%%capitalComponentName%%.tsx' // Scaffolder for a solid jquery component jqueryComponent: options: questions: // In which module do we have to create the new component ? name: 'moduleName' type: 'input' message: 'Module name - CamelCase :' // What is the component name ? name: 'componentName' type: 'input' message: 'JQuery component name CamelCase :' filter: filter template: 'skeletons/components/componentStyle': '{= path.src }%%moduleName%%/components/%%componentName%%/%%capitalComponentName%%.less' 'skeletons/components/jqueryComponentScript': '{= path.src }%%moduleName%%/components/%%componentName%%/%%capitalComponentName%%.tsx' ;};
React file exemple
import {React, ReactDom, ReactView} from "lib/solidify/core/ReactView";
interface Props extends __React.Props<any>
{
}
interface States
{
}
export class %%capitalComponentName%% extends ReactView<Props, States>
{
prepare ()
{
}
render ()
{
return (
<div className="%%capitalComponentName%%">%%capitalComponentName%%</div>
);
}
}
Less file exemple
// Import module dependencies as reference
@import (reference) '../../Main';
.%%capitalComponentName%%
{
}