Skip to content
jeremydmiller edited this page Jul 13, 2011 · 3 revisions

Asset Management

Existing Functionality

  • Script Dependency Management DSL
    • CRUD includes jquery.forms.js, jquery.validation.js, blah (Named Script Sets)
    • DSL (*.script.config) files
    • A requires B (dependencies)
    • A1 extends A (extensions)
    • jquery is jquery.1.4.js (aliasing, helps with versioning)
    • ordered set CRUD is (ordered named sets)
  • this.Script() -- add a new script dependency in the view itself to the graph (or in a script activator). Does NOT write script tags out. Can be a set name, a script name, or an alias
  • ScriptRequirements -- class scoped to a request that allows code to add a new script dependency. this.Script() extension method delegates to ScriptRequirements. Html helpers or view activators or even other behaviors can use ScriptRequirements to add scripts to a view
  • this.CSS() -- adds a single CSS tag to a page.
  • this.WriteScriptTags() -- writes out all the script tags out, using the declarations and script dependencies to both find and order the tags on a page

Outstanding work

  • CoffeeScript support server side
    • Production mode where the converted file is cached
    • Dev mode where the conversion happens on the fly. Maybe do this with client side interpretation instead?
  • "Page" Script -- scripts that bypass dependencies and go to the bottom
    • this.PageScript(name)
    • Automatically match /folder/thisview.js to /folder/thisview.spark (or thisview.aspx) as a PageScript to encourage the externalization of javascript goop with less friction and hopefully get more JS unit testing going on
  • Utilize IIS caching of content files for package content. This is a serious perf. concern at Dovetail. My recommendation is to copy the content files for packages under ~/content/[package name] with an IActivator for zip file packages
  • SASS / LESS integration
  • Allow CSS files to be dynamically declared externally to a page through view activators. We want this at Dovetail for extensibility scenarios with customer specific styles
  • Bring CSS files into the ScriptGraph world so you can use dep's and sets
  • Per Ryan Rauhr's suggestion, ScriptGraph becomes AssetGraph(?) -- Big advantages. Probably makes for a lot of code sharing betwixt SASS / LESS / CoffeeScript / the next thing that generates javascript or CSS on the fly
  • Pluggable Script / CSS Combination strategies -- I wanna accomplish this through drop in bottles
  • Minification strategies -- again, dropin bottles
  • CDN support
  • Cache busting
  • Diagnostics Baby!!!
    • Activator that runs last and fails the app bootstrapping if a named set refers to a script that cannot be found
    • Diagnostic page that lets you interactively test which scripts would be loaded for calls to Script() or CSS()
    • Runtime tracing of script loading for the request tracing feature in adv. diagnostics
      • Which scripts were loaded, how, and from what file location
      • Requested scripts that could not be found
    • diagnostic page that lets you see what the script configuration picked up and app startup time