Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme assets #87

Closed
yourivdlans opened this issue Jan 5, 2012 · 4 comments
Closed

Theme assets #87

yourivdlans opened this issue Jan 5, 2012 · 4 comments

Comments

@yourivdlans
Copy link
Contributor

I've been trying to use the new asset compress theme support, but I've stumbled upon some weird behavior.

When building a theme file and your theme structure is as follows:

themed/
----mytheme/
--------webroot/
------------css/
------------img/
------------js/

You will get errors saying some files could not be found. This is because the scanner will look for the files in webroot.
For the time being I've created a stylesheet and js file in the theme's webroot which will import / require my theme assets.

Maybe this was intended, I don't know. Just thought I should report it.

@markstory
Copy link
Owner

What does the build file definition look like for the file your having trouble with?

@yourivdlans
Copy link
Contributor Author

This is my build file definition:

[default.css]
theme = true
files[] = screen.css
files[] = theme:menu.css
files[] = theme:style.css

I've looked through the code a bit, and maybe you could do something like this to add the correct asset folder to the retuned path.

asset_compress/libs/asset_scanner.php:108

protected function _resolveTheme($file) {
    $file = preg_replace(self::THEME_PATTERN, '', $file);
    $ext = pathinfo($file, PATHINFO_EXTENSION);

    switch ( $ext ) {
        case 'css':
            $folder = 'css' . DS;
        break;

        case 'js':
            $folder = 'js' . DS;
        break;

        default:
            $folder = null;
        break;
    }

    return App::themePath($this->_theme) . 'webroot' . DS . $folder . $file;
}

@markstory
Copy link
Owner

Or you could put the path in the build file definition? Adding it in when resolving assets means there is a chance for duplicate paths.

@yourivdlans
Copy link
Contributor Author

Yeah that would be better, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants