Modules plugin: CSS file for each module


#1

@lukasbestle & @sashtown:

Thank you very much for this great plugin!

I have installed it and the demo branch.

But the css-files aren’t loaded.
What is the best solution, to add these files to the corresponding webpage, if I don’t want to use the Patterns plugin?

To add e.g.

  <?php echo css('site/modules/text/text.css'); ?>

in the header.php snippet don’t works because of the .htaccess file rule “block all files in the site folder from being accessed directly”.


Kirby Modules Plugin
#2

The best way would be a build process using a tool like gulp or Grunt. You can then combine all CSS files with a wildcard like site/modules/*/*.css into a single file, minify that and place it in the assets directory.


#3

Thank you @lukasbestle, that is a way. I can use the Sass plugins for Kirby v2.

But I dream of an extension of the Modules Plugin that works like Kirby does it for assets of plugins, known as Public URLs for plugin assets


#4

You can build a route that does this yourself, but please note that it isn’t good from a performance perspective (at least until HTTP/2) to use many small asset files.


#5

ok, but my knowledge of how to build that route is to low :cry:


#6

You can take a look at this example for the plugin assets. :slight_smile:


#7

Thank you very much for your always quick reply.

I will try soon… :slight_smile: