statamic / ssg

The official Statamic Static Site Generator
235 stars 24 forks source link

Glide cache still generated when using external source #178

Open conradfuhrman opened 1 day ago

conradfuhrman commented 1 day ago

For our SSG project we have three separate buckets on S3.

project-assets project-glide project-ssg

Assets is uploaded assets Glide is a specific bucket just for glide generated items SSG is our bucket for the final transfer and compile.

When SSG is run, even though these glide assets exist in an external bucket, they are still generated. It would be great to add a flag to enable/disable the generation of these assets along with additional asset_url's for these items.

Since we use them in a separate bucket, the links should just maintain to the glide bucket. Or, as we have had to do in certain instances, we use an S3 sync to copy those glide items to the ssg bucket.

Please let me know what info would help to illustrate this if needed :)

duncanmcclean commented 1 day ago

When SSG is run, even though these glide assets exist in an external bucket, they are still generated.

Just to clariify, when you say the assets are "still generated". Do you mean they're generated again in the glide bucket or are they being generated again in the ssg bucket when they don't need to be?

conradfuhrman commented 1 day ago

In our github action docker box. We simply don't need the glide images generated in this case.

duncanmcclean commented 1 day ago

What does your config/statamic/ssg.php config file look like?

conradfuhrman commented 1 day ago

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Base URL
    |--------------------------------------------------------------------------
    |
    | This informs the generator where the static site will eventually be hosted.
    | For instance, if you are relying on absolute URLs in your app, this one
    | will be used. It should be an absolute URL, eg. "http://my-app.com"
    |
    */
    'index_files' => true,

    'base_url' => env('APP_URL'), 

    /*
    |--------------------------------------------------------------------------
    | Destination Directory
    |--------------------------------------------------------------------------
    |
    | This option defines where the static files will be saved.
    |
    */

    'destination' =>  storage_path('app/static'),

    /*
    |--------------------------------------------------------------------------
    | Files and Symlinks
    |--------------------------------------------------------------------------
    |
    | You are free to define a set of directories to be copied along with the
    | generated HTML files. For example, you may want to link your CSS,
    | JavaScript, static images, and perhaps any uploaded assets.
    | You may choose to symlink rather than copy.
    |
    */

    'copy' => [
        public_path('build') => 'build',
        public_path('css') => 'css',
        public_path('js') => 'js',
        public_path('images') => 'images',
    ],

    'symlinks' => [
        // public_path('build') => 'build',
    ],

    /*
    |--------------------------------------------------------------------------
    | Additional URLs
    |--------------------------------------------------------------------------
    |
    | Here you may define a list of additional URLs to be generated,
    | such as manually created routes.
    |
    */

    'urls' => [
        //
    ],

    /*
    |--------------------------------------------------------------------------
    | Exclude URLs
    |--------------------------------------------------------------------------
    |
    | Here you may define a list of URLs that should not be generated.
    |
    */

    'exclude' => [
        //
    ],

    /*
    |--------------------------------------------------------------------------
    | Pagination Route
    |--------------------------------------------------------------------------
    |
    | Here you may define how paginated entries are routed. This will take
    | effect wherever pagination is detected in your antlers templates,
    | like if you use the `paginate` param on the `collection` tag.
    |
    */

    'pagination_route' => '{url}/{page_name}/{page_number}',

    /*
    |--------------------------------------------------------------------------
    | Glide
    |--------------------------------------------------------------------------
    |
    | Glide images are dynamically resized server-side when requesting a URL.
    | On a static site, you would just be serving HTML files without PHP.
    | Glide images will be pre-generated into the given directory.
    |
    */

    'glide' => [
        'directory' => 'img',
        'override' => true,
    ],

    /*
    |--------------------------------------------------------------------------
    | Failures
    |--------------------------------------------------------------------------
    |
    | You may configure whether the console command will exit early with a
    | failure status code when it encounters errors or warnings. You may
    | want to do this to prevent deployments in CI environments, etc.
    |
    */

    'failures' => false, // 'errors' or 'warnings'

];
conradfuhrman commented 1 day ago

More of what I think is important is that glide cache from the assets.php we have set to this:

'cache' => 'glide',
'cache_path' => public_path('img'),