Exorcism

Hi

My app on live server requests bootstrap fonts from an old published asset which existed on development machine and thus the fonts isn’t loaded.

I’m using combining-compressing-assets technique for production mode and everything works fin except the problem I already mentioned.

The problem only appears on production mode and on server.

Both production and development mode works without any problem on development machine.

Also development mode (without compressed and combined assets) works without any problem on server.

It might be there’s no permission problem because all assets generates in assets directory in development mode and even those are not included in combiner can publish their stuffs in asset directory.

This is on of the three requests URL:




http://1394.com/assets/93671dc4/fonts/glyphicons-halflings-regular.woff



The part "93671dc4" is name of a asset which had been published on development machine.

I use GIT for synchronize my app with server.

The app is in advanced mode.

Should I call a priest ?

I couldn’t find a convenient title for this post. So, you offer me one if you’d like.

Probably you already tried it but I suggest anyway.

Delete all files in assests directory

Delete all files from cache directory

till now never used the assets combining but I guess it use some files form cache for the process. Maybe you copied something from devel machine that create the problem.

Thanks for your help.

Yes I already did it a few times but it didn’t work.

Here is some more details:

As you’ve already guessed The referrer of those requests are the compressed css file.

Here is my asset configuration if it helps.


/**

 * Configuration file for the "yii asset" console command.

 */


// In the console environment, some path aliases may not exist. Please define these:

Yii::setAlias('@webroot', __DIR__ . '/frontend/web');

Yii::setAlias('@web', '/frontend/web');


return [

    // Adjust command/callback for JavaScript files compressing:

    'jsCompressor' => 'java -jar compiler.jar --js {from} --js_output_file {to}',

    // Adjust command/callback for CSS files compressing:

    'cssCompressor' => 'java -jar yuicompressor.jar --type css {from} -o {to}',

    // The list of asset bundles to compress:

    'bundles' => [

        'yii\web\YiiAsset',

        'yii\web\JqueryAsset',

        'frontend\assets\PollAnswerAsset',

        'yii\bootstrap\BootstrapPluginAsset',

        'yii\bootstrap\BootstrapAsset',

        'airani\bootstrap\BootstrapRtlAsset',

        'frontend\assets\AppAsset',

        'yii\validators\ValidationAsset',

        'yii\widgets\ActiveFormAsset',

        

    ],

    // Asset bundle for compression output:

    'targets' => [

        'all' => [

            'class' => 'yii\web\AssetBundle',

            'basePath' => '@webroot',

            'baseUrl' => '@web',

            'js' => 'js/all-{hash}.js',

            'css' => 'css/all-{hash}.css',

        ],

    ],

    // Asset manager configuration:

    'assetManager' => [

        'basePath' => '@webroot/assets',

        'baseUrl' => '@web/assets',

        'appendTimestamp' => true,

    ],

]; 

I solved it!

The solution:

I Combined and compressed the assets using "asset" command on server again. It publishes new assets according to the new compressed css and js files.

Combined and compressed files on development machine depends on their specified published assets. It’s important to know these published assets is generated during asset command procedure NOT loading the page.

My mistakes:

First of all I’d already did that before but a human mistake in creating asset config file made me miss the correct result.

Secondly, I thought there’s nothing to do with publishing assets when we use combining and compression approach and at least the asset bundles that are included in the config doesn’t publish new assets but it was a deadly mistake.

If somebody doesn’t believe in my words correct me, please.