Skip to content
Template package for atom editor
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
keymaps
lib
menus
spec
styles
.gitignore
CHANGELOG.md
LICENSE.md
README.md
package.json

README.md

atom-smart-template package

The package is designed for quick and easy creation of file or multiple files and directories from a template using parameters.

How to use

Use the command "Create files from template" from the context menu of the file tree.

How to create new template

The main file of template is "index.js":

module.exports = {

    name: "Base template",

    params: ["Name", "Body"],

    directory: false,

    rules: function(config) {

      return({
        items: [
          { destinationFile: "index.html",           sourceTemplateFile: "index.template"    },
          { destinationFile: "images/someimage.jpg", sourceContentFile: "img/someimage.jpg" }
        ]
      });

    }

}

The rules function has a config parameter which contains the values entered by the user when creating the template. You can use these values to generate the names and content of destination files. Also you can simply copy the files from your template (sourceContentFile) to the target folder without processing.

Optional directory property to template options. If enabled, while creating files from template, there will be a parent directory created as well. It's name will be same as the "Name" parameter set - if available. Otherwise, it'll take the name of the template itself.

You can’t perform that action at this time.