Jump to content

Module: Spex: An asset and template management module


Jonathan Dart
 Share

Recommended Posts

  • 2 months later...

Not sure where this should be addressed, but Spex uses the $config->styles $config->scripts to collect those assets.

But to work with AIOM it needs to be relative to /templates/ folder . But if I want custom modules that for examples adds it's own css to the $config->styles->add() and the path to that will be in the module folder /site/modules/MyModule/MyModule.css it doesn't work. 

Also from time to time third party modules don't happend to have a check if on backend or frontend, and the populate the $config->scripts even on front-end, which results in an error in AIOM.

Wouldn't it be better to have a custom $config->siteScripts $config->siteStyles filearray (same as PW backend) to populate assets? This would be to avoid conflicts.

Link to comment
Share on other sites

  • 2 weeks later...

Hi there,

I've just started to use Spex and am trying to retrofit it to a basic site.

In the <head> section of _base.php, I have the following line:

<?php echo $spex->addStyle($config->urls->templates . 'css/app.css'); ?>

However, the style is not added into the <header>. I've no idea why and would appreciate any thoughts.

Any ideas/help would be much appreciated.

Thanks!

Link to comment
Share on other sites

Maybe does the example site help that comes with it

https://github.com/jdart/Spex/blob/master/example-site/_init.php#L30

The path for the file is relative to /templates/...  but you got the absolute path.

And you need something like this line to output the styles: here using AIOM (AllInOneMinify) module

https://github.com/jdart/Spex/blob/master/example-site/layouts/_base.php#L16

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • 8 months later...

Anyone having troubles with Spex 0.9.9 and Processwire 2.6.10 like addressed here https://processwire.com/talk/topic/8444-modules-crashing-processwire-sites-and-having-other-problems/

That was ProcessWire 2.5.10 mentioned in that post.  We are now at ProcessWire 2.6.1

Make sure you are running PHP version 5.3.8 or higher.  Also make sure that all of your modules are compatible with the ProcessWire version.

Link to comment
Share on other sites

Oh yes, wrong version, still with 2.6.1 no luck here, still getting 

Compile Error: require(): Failed opening required '/customers/c/c/1/traumawien.at/httpd.www/site/templates/layouts/default.php' (include_path='.:/usr/share/php') (line 186 of /customers/c/c/1/traumawien.at/httpd.www/site/modules/Spex/Spex.module) 

running on PHP 5.6 only with JqueryDataTables, ModulesManager, ProcessBatcher, TextformatterHannaCode, LoginPersist, MarkupSitemapXML, ProcessRedirects, TextformatterVideoEmbed, InputfieldChosenSelect, ProcessWireUpgrade installed.

Any idea?

Link to comment
Share on other sites

Does you have the folder and file mentioned in the error: site/templates/layouts/default.php? means: does it exist?

AFAIK does SPEX want/need to copy some files during installation to site/templates/layouts/ and in regard of the filesystem settings this may have failed without notice.

But the default files it uses are _base.php and one-column.php, but not default.php.

So, with the template / page you are loading you must have set $spex->setLayout('default');
 

Does that help?

Link to comment
Share on other sites

Thanks for your help Horst, the problem was that an _init.php file already existed so the layout was nowhere set and the default name for it is of course not one-column, but default.php

Working like a charm now!

  • Like 1
Link to comment
Share on other sites

  • 7 months later...
  • 4 weeks later...

Do I have to abandon Spex if I go to Processwire 3? It does not seem to work. Not for me right now anyway.

See this other post.

For all followers: A single line (250) needs to be changed to work with PW 3+.

		$include_fuel ? wire('all')->getArray() : array(),

( see this post: https://processwire.com/talk/topic/12298-update-273-to-308-processwiregetarray-does-not-exist/#entry114410 )

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...