InsaneDoggo / PackageTemplates

http://ceh9.github.io/PackageTemplates/
Apache License 2.0
37 stars 7 forks source link

Can not import the exported json #12

Closed idododu closed 7 years ago

idododu commented 7 years ago

Description

I created a template which can generate two files(1 html + 1 js), and it works great. However, when I shared my template to a collegue, he just could not import the json files.

I modified 'listBaseElement' property to a empty array, and it can be imported.

below is my template, please help take a look, @CeH9

{
  "name": "modalPage",
  "description": "Manual:\n1. Do foo\n2. Do bar",
  "directory": {
    "listBaseElement": [
      {
        "templateName": "HTML File",
        "extension": "html",
        "mapProperties": {},
        "name": "${BASE_NAME}.html",
        "isEnabled": true,
        "script": "",
        "writeRules": "FROM_PARENT",
        "CLASS_META_KEY": "File"
      },
      {
        "templateName": "JavaScript File",
        "extension": "js",
        "mapProperties": {},
        "name": "${BASE_NAME}.js",
        "isEnabled": true,
        "script": "",
        "writeRules": "FROM_PARENT",
        "CLASS_META_KEY": "File"
      }
    ],
    "name": "${BASE_NAME}",
    "isEnabled": true,
    "script": "",
    "writeRules": "OVERWRITE"
  },
  "mapGlobalVars": {},
  "listGlobalVariable": [
    {
      "name": "BASE_NAME",
      "isEnabled": true,
      "script": "",
      "value": "modalName"
    }
  ],
  "listTextInjection": [],
  "skipRootDirectory": true,
  "skipDefiningNames": false,
  "shouldRegisterAction": true,
  "shouldShowReport": false,
  "fileTemplateSource": "DEFAULT_ONLY"
}

Another proposal

Can we export all templates at one click? Currently 'Export' function can only work on a specified json.

InsaneDoggo commented 7 years ago

Hi, thx for report. Is FileTemplate custom(Created via IDE Settings)? Check exported FileTemplates in yourPath/templateName/fileTemplates/yourTemplate.xml it should contains all FileTemplates (Excluding non custom). If template built-in you can duplicate it as custom with another name. P.S. check similar issue #7

idododu commented 7 years ago

As you can see, template name is "templateName": "HTML File", it is a internal template rather than custom file template

I have tried v0.4.3, but it does not work neither.

InsaneDoggo commented 7 years ago

Plugin doesn't support import\export of default FileTemplates. IDE can overwrite default templates with new versions\updates. Furthermore, other devs could not expect that your FileTemplates overwrite default ones. I'm recommend to use copy pasted versions, even if they have no difference. P.S. it's ok to use same FileTemplates(custom) in multiple PackageTemplates from same author\team\company.