Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Assets inside a module
  • Hello, I'm new here and I'm wondering about the handling of assets within a module. Modules are meant to be independent. They may contains specific assets, provided by the module itself. I mean if I develop a module, I want to put my assets right inside my own independent folder.
    This way, I just publish a zip with everything inside (classes, config, views and assets) and we're good to go. Actually, I need to copy my assets in (for example) the ~/public/modules/my_module_name/ (my own convention I decided to use). So I need a procedure to install the plug-in to make it work. I cannot imagine there is nothing built-in for that. Is there something planned to handle assets inside a module?
    How should I proceed?
  • I use symbolic links, automated by a pseudo-install function in my modules. See this pull request I just posted. https://github.com/fuel/core/pull/268 I use a config file that reads "installed" => false until it is first called then it adds the symlink and changes "installed" to true. After that the values is checked incase I ever need it to create the symlink for me again.
  • Hi, I would look at Casset to see if that offers the flexibility you are after. I would suggest that this replace the standard asset class anyway as it provides so much more ease of use and flexibility which is what Fuel is about after all. Just my 2cents worth. Phil.
  • Welcome here! Since your code is (or should be) outside the docroot, you'll have to deal with two locations. I use this stucture for my modules:
    fuel root
    - modules
      - modulename
    - public
      - assets
        - modulename
          - css
          - js
          - img
    
    Note that I have moved the modules directory out of app, and into the fuel root. Currently there is no set system for modules, as there is for packages. This might change in the future, as we're thinking about a centralized system for publication of third-party code, which you can install using our commandline tool 'oil'.
  • You mean packages can be installed via oil but modules don't have this privilege (yet)? Packages are not meant to deal with public assets, right? I'm writing some code to enable / disable modules which are chosen from an external folder (a repository). So I'll deal with assets on my own since there is no built-in possibility. ;) Thanks for the quick answer!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion