Jump to content

Reference external files in snippets


averagejoe
 Share

Recommended Posts

It would be good if we had the option to reference an external file for snippets instead of relying on snippet text box. This could be a powerful tool for developers.

 

For example... I am developing a website and need quick access to jQuery.

 

I could have a snippet called with !getjquery which then calls http://code.jquery.com/jquery.min.js and pastes it's contents.

 

Need to quickly copy in Bootstrap? File -> new -> "bootstrap.css" -> !getbootstrap -> calls https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css and instantly pastes it in your file. Save. Done.

 

No terminal commands or google searches, or remembering URLs.

 

These are just basic examples. You could build an entire snippet library of external files you reference on a daily basis.

 

You could create gists or dedicate entire git repositories to your snippets instead of using the fairly basic Snippet textarea inside Alfred... they could even be shared within the community.

 

If you have a fairly comprehensive snippet, wouldn't it be great if you could update it simply by making changes in your code editor and pushing the changes to git, instead of opening Alfred, copying the snippet into your text editor, making changes, copying it back, saving.. 

 

I have my own HTML5 boilerplates, css frameworks, useful snippets, small custom jQuery plugins... imagine pulling these in with one word !getsomething

 

I know there are other methods such as Bower, command line, etc. and snippets built in to some apps.. nothing would be as quick as this and it would be system wide.

 

Edited by averagejoe
Link to comment
Share on other sites

Instead such a specific feature, having the ability to run scripts/workflows from snippets would both solve this and allow many other possibilities.


For your current situation, @averagejoe, you might want to try TemplatesManager. It didn’t have the feature to directly paste the contents of a remote file, but it was easy enough to add. It’s different than adding via a snippet, but it may be of use.


Copy to your clipboard all those links you want (one at a time) and run rtma for each. After that, for pasting you simply rtml and ⌘↩.

Link to comment
Share on other sites

10 hours ago, deanishe said:

Snippets are JSON files. Why not use a git hook to (re-)generate the JSON files when you push a change to your snippets repo?

 

Thats a possibility, will look into it.

 

8 hours ago, vitor said:

Instead such a specific feature, having the ability to run scripts/workflows from snippets would both solve this and allow many other possibilities.


For your current situation, @averagejoe, you might want to try TemplatesManager. It didn’t have the feature to directly paste the contents of a remote file, but it was easy enough to add. It’s different than adding via a snippet, but it may be of use.


Copy to your clipboard all those links you want (one at a time) and run rtma for each. After that, for pasting you simply rtml and ⌘↩.

 

Thanks for the plugin suggestion will look at it. I like the idea of executing snippets/work flows from a snippet.

 

Would still be good to hear from Alfred dev if it is possible to reference remote files.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...