Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
documentation
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
6 Aug 2014 at 21:12 UTC
Updated:
6 Aug 2014 at 21:30 UTC
Jump to comment: Most recent
Comments
Comment #1
webchickIIRC there are at least 4 ways to do this:
1) Adding a quick bit of CSS/jS that's custom to your module on one particular page inline.
2) Adding one or more CSS/JS files together as a "library" and declaring it as such in your module.libraries.yml file, then using it later in your module.
3) Adding an external CSS/JS library from some URL somewhere as a library
4) Adding run-time JS "settings" to a library.
I'm not sure which of these should be in the API topic page and which should be linked to in the full docs at https://www.drupal.org/node/2274843. I guess we should grep and see what are the most common "80% cases."
Here are some resources I know about, though I can't attest to how up to date they all are:
- https://www.drupal.org/node/2228783
- https://www.drupal.org/node/2274843
- http://highrockmedia.com/blog/drupal-8-attaching-core-libraries-and-othe...
- https://www.drupal.org/node/2298551 < somewhat inconclusive.
Comment #2
webchickOops. I missed that Jennifer had already created #2301851: Make sure module developers have info on adding js/css to pages which covers the same ground and has a better issue summary. Closing this as a duplicate.