Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The recommended way to include view-specific assets? #13

Closed
sfmskywalker opened this issue Jul 26, 2011 · 2 comments
Closed

The recommended way to include view-specific assets? #13

sfmskywalker opened this issue Jul 26, 2011 · 2 comments

Comments

@sfmskywalker
Copy link

Certain views require scripts & css that are specific for that view.
What is the recommended approach:

  1. Create a separate module (subfolder) for the view
  2. Manually create a script / link HTML element (using razor sections)
  3. Use a secret Cassette API function that allows me to add a reference to a specific file that will not include all other files that are in the same folder
  4. Something else?
@andrewdavey
Copy link
Owner

Option 1 - will work fine and scale nicely when you then want to refactor a large page script into nice small files :)

Option 2 - works, but you lose all the minification, etc.

Another possible option: Write your scripts and styles so they can be loaded into any page (e.g. check the URL before calling $(document).ready). The stick them all into a single module. However, This may result in a large amount of script to be parsed by the page, which then only uses a fraction.

@sfmskywalker
Copy link
Author

You're right about option 1 - Cassette is such a relief, I can create many smaller assets without worrying about browser performance!
Thanks for that third suggestion. Although that's an interesting idea, I will stick with option 1 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants