Everything that needs to be accessed by URL normally goes under the assets/ directory. Otherwise, things will break when you relocate the core above the MODX root directory.
-
☆ A M B ☆
- 2,475 Posts
Thanks Bob. That’s kind of a bummer... I want to release this with all of its components in one directory... the CSS etc. is for manager use only, so I don’t know if it really belongs in the assets directory. I can write my own code to determine the URL based on the site URL and the core directory...
Most components with URL-accessible files have two directories:
assets/components/componentname/
and
core/components/componentname/
Anyone familiar enough with MODX will look in the assets one for URL-accessible stuff.
-
MODX Staff
- 10,725 Posts
Nothing in your core should be accessible via URL. The core itself can be located outside of the web root. Nothing that needs to be accessible by URL should ever go in the MODX_CORE_PATH location.
FWIW, the base_path and base_url is for the web accessible root directory where the index.php gateway exists. And assets_path and assets_url could be different from that.
-
☆ A M B ☆
- 2,475 Posts
But what if it's only your CMP that requires these assets? E.g. a CSS page used only for your CMP... there's no reason that needs to be in the assets/ folder. It doesn't need to be in the same location as the CSS or JS or connectors that are available to the front-end.
If your CSS file is accessed by href, it needs to be accessible by URL and it won't be if it's in the core and the core has been moved outside the web root.
That's why the conventional place for it is assets/components/mycomponent/css/mycomponent.css. That's where people familiar with MODX will look for it.