ignite icon indicating copy to clipboard operation
ignite copied to clipboard

Link to file content

Open DavidFrahm opened this issue 9 years ago • 8 comments

I love the way that ignite scaffolds structure, but I do wish that I could somehow direct users to content if they want it. Even on an individual file basis, such as allowing a URL to be the only content in a file created by ignite templates.

For example, in an AngularJS or Ionic scaffold, there would be a karma.conf.js file. This is not app logic, only the configuration for running tests. As such it is very closely related to the structure, which was provided by the template.

I'd like to give the user a URL they can use to go get a typical boilerplate version of that file, if they want to.

Something as simple as this would be enough for me:

"some-folder": {
    "_files": [{file: "karma.conf.js", url: "http://github.com/some-org/some-repo/some-file"}]
}

DavidFrahm avatar Apr 03 '15 02:04 DavidFrahm

Or maybe link them to a repo where they can see the same structure as the template, but with content?

That could even just be a link in a template README somewhere.

DavidFrahm avatar Apr 03 '15 02:04 DavidFrahm

A solution for that right now would be implementing it as the description for your template. Currently, it's only logged whenever you ignite describe a template, but maybe it should describe the template before/after scaffolding too.

bradcypert avatar Apr 03 '15 02:04 bradcypert

I like this idea.

@bradcypert solution is currently the best option. If you check out the 'es6-api' branch you'll see we have begun to introduced a way to do http requests.

One issue that will need to be considered is offline support, as I feel this is a very important feature.

wookiecooking avatar Apr 03 '15 02:04 wookiecooking

I agree. Deviating from offline support is deviating from the vision of this project.

bradcypert avatar Apr 03 '15 03:04 bradcypert

I attempted some of this idea here I'll revisit once I get some more time / think about more.

wookiecooking avatar Apr 03 '15 07:04 wookiecooking

I would like to look into the idea of dropping the json files into their own directories, where the directories themselves could contain files for templates. If the file exists, it would simply copy the contents to the file.

Directory

templates/
 express/
   lib/
     controllers.js
   express.json
   app.js

Schema

"dir":{
  "lib":{
   "_files":['controller.js']
  },
  "_files":['app.js', '.gitignore']
}

While I played with the idea of http requests, I feel like local file storage would be the way to go. This also keeps older schemas and versions from breaking.

wookiecooking avatar Apr 05 '15 20:04 wookiecooking

Personally, I'm against adding content to the files at all. Unless we can find a way to meet everyone's needs with code structure, content, etc, I'm very opposed to this.

bradcypert avatar Apr 12 '15 01:04 bradcypert

That being said, I thought about it some more and if we added a flag --dry or something that just scaffolded out structure, I think that'd be fine.

bradcypert avatar Apr 14 '15 00:04 bradcypert