Skip to content

Commit 91a892c

Browse files
authored
Merge pull request #353 from larsroettig/pwa-livetemplate
Add pure function liveTemplate
2 parents 25bfa0a + 0dffbf0 commit 91a892c

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

resources/META-INF/plugin.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@
211211
<internalFileTemplate name="Magento Module Layout Xml"/>
212212
<internalFileTemplate name="Magento Module ACL XML"/>
213213

214+
<defaultLiveTemplates file="/liveTemplates/MagentoPWA.xml"/>
215+
214216
<postStartupActivity implementation="com.magento.idea.magento2plugin.project.startup.CheckIfMagentoPathIsValidActivity"/>
215217
</extensions>
216218

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<templateSet group="MagentoPWA">
3+
<template name="pwac" value="import React from 'react';&#10;import {mergeClasses} from '@magento/venia-ui/lib/classify';&#10;import { shape, string } from 'prop-types';&#10;&#10;import defaultClasses from './$CSS_FILENAME_BASE$.css';&#10;&#10;const $TM_FILENAME_BASE$ = props =&gt; {&#10; const classes = mergeClasses(defaultClasses, props.classes);&#10; return (&lt;div className={classes.root}&gt;$END$&lt;/div&gt;);&#10;}&#10;&#10;$TM_FILENAME_BASE$.propTypes = {&#10; classes: shape({root: string})&#10;};&#10;$TM_FILENAME_BASE$.defaultProps = {};&#10;export default $TM_FILENAME_BASE$;" description="Creates a PWA Studio pure function component" toReformat="true" toShortenFQNames="true">
4+
<variable name="CSS_FILENAME_BASE" expression="decapitalize(camelCase(fileNameWithoutExtension()))" defaultValue="" alwaysStopAt="true" />
5+
<variable name="TM_FILENAME_BASE" expression="capitalize(camelCase(fileNameWithoutExtension()))" defaultValue="" alwaysStopAt="true" />
6+
<context>
7+
<option name="JAVA_SCRIPT" value="true" />
8+
<option name="TypeScript" value="true" />
9+
</context>
10+
</template>
11+
</templateSet>

0 commit comments

Comments
 (0)