Auto Create Static Resource

  • 3
  • Idea
  • Updated 3 years ago
  • Not Planned
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb

Posted 3 years ago

  • 3
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
And the ability to open, edit and save in the built in Ace editor.

Then ability to add and manage code snippets like Sublime Text 3.
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Pat...One of our guys (Robert Mruczek) wrote a short tutorial on using a Gulp script to automate the process of creating and updating static resources.  It's focused on setting them up for component development, but I think you can use it your use case.

I also agree that it would be nice to have this 'built-in' connection to an external editor.  This opens the route to versioning using Git.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Just read his tutorial. Looks pretty cool in certain ways. Automates the process of zipping and deploying from dev to static resource.

Not sure this would be useful in what I'd like. I'm looking for the file to be created from Skuid w/ one click so I can get it as a static resource in sublime text.

Sure, I can probably set it up to watch/deploy the file when there's a change. That would be cool. Save me from a few clicks each time.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Yup. It would be awesome to get both a CSS and JS Static Resource automatically created for every page. Apex trigger that and keep it synced by name of page. Then include the standard page load and snippet code in the static file.

Then I could setup auto deploying changed files back to salesforce.

Hello Sublime coding bliss!
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
+1

No, more like +10
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,006 Points 5k badge 2x thumb
+1
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,096 Points 10k badge 2x thumb
Guys - Pressed on time but a few quick thoughts...

1) Check out MavensMate for Sublime Text and Resource Bundles - http://www.joe-ferraro.com/2012/12/mavensmate-resource-bundles/.  This is a quick and easy way to create static resources using standard JS/CSS, images, etc.  MavensMate resource bundles takes care of the packing and upload for you, it's really slick and where I started when I first entered the SFDC/Skuid world.

2) I've evolved from the above for several different reasons and now use Grunt (similar to Gulp that Bill mentions above - I've actually considered migrating to gulp).  The way I manage things currently is I have a separate directory for all JS/CSS/etc.  and use grunt to run tests (this is CRITICAL for any serious development in my opinion), lintify (check syntax, coding standard, etc.), minify/uglify (reduce size, increase perf, etc.), zip and upload to SFDC.  There's lots of info out there on how to make this all work.  In short, I use Sublime Text to code, run a grunt task via Sublime Command Console and/or O/S command window and it performs all the steps and uploads.  My Zip file contains multiple JS/CSS files that can then be referenced on a page.  This puts all the code in one place, ensures its tested, properly written, etc.  Just my $0.02 but I'd strongly recommend an approach like this instead of embedding code inside of the skuid page itself as there is no way to test it when it's in a page and also you can't reuse things and end up having to copy/paste a lot.  You also could end up with a ton of static resources if you have one for each page.  This way, everything is is on ZIP file as a single static resource.

MM w/ Resource Bundles is a great starting point if you just want to dip your toes in.

As always, your mileage may vary :)
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Thanks Barry - we also use a similar set of tools in our dev process. 
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
I've been using Sublime Text and MavensMate for a little white more and more. I used to be able to automatically update my single file static resources, but now it seems since Winter 16' that everything seems to go through a deployment process, which is 2-3x longer. 

I've been looking at using Resource Bundles, but just haven't made the switch yet. I do agree with you that there is much optimization available in the learning curve. Gulp seems like something I must learn along with Resource Bundles to really optimize everything.

What kind of time does it take for the average resource bundle to deploy?
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,096 Points 10k badge 2x thumb
Hey Pat -

I haven't noticed a difference as of Winter '16 with Sublime/MM.  MM did release version 5 a little while ago which caused a lot of issues.  They have since pulled version 5 and replaced it with version 6 which is really just version 4.  Make sure you are running version 4 or version 6 and not version 5 as if you are, that may be why you are seeing some issues/delays.  

Its been a long time since I used resource bundles but I remember them going through the packing process very quickly.  Once packaged, the "upload" time is depdenent on your internet connection, SFDC load, size of the resource, etc. but it should be rather quick assuming your static resource isn't too large.  I actually have a separate static resource for Images since they don't change often.  This keeps the JS/CSS static resource size to a minimum and packing/upload is quick.