jazzband / django-pipeline

Pipeline is an asset packaging library for Django.
https://django-pipeline.readthedocs.io/
MIT License
1.52k stars 372 forks source link

Support remote assets #385

Open jcockhren opened 9 years ago

jcockhren commented 9 years ago

It would be (more than) awesome if there was a way to pull remote assets just before it all runs.

For example:

PIPELINE_CSS = {
    'site': {
        'source_filenames': (
            'css/font-awesome.min.css',
            'css/custom.css',
            'https://cdn.somethingcool.com/assets/widgets.css'
        ),
        'output_filename': 'css/site.css'
    }
}

This allows organizations that already have their support assets in the cloud to leverage pipeline for the inclusion rather than duplicating them in the repo.

It's a bit much so I can help with this. Mainly made an issue so all can see and we can discuss all the avenues with the would-be users. Thoughts?

gtaylor commented 9 years ago

I wonder if doing this in a signal receiver in your app might be the better way to go?

Though, I'm not sure there's a pipeline signal that makes sense (yet).

jcockhren commented 9 years ago

Yeah, there's only two so far: http://django-pipeline.readthedocs.org/en/latest/signals.html

I actually wouldn't mind if there was a signal thrown for every source filename pre-compression. Works for me. Want a PR spike?

gtaylor commented 9 years ago

I can't make that call, but FWIW signals after Django 1.3 (I think) are much lighter on resource consumption than pre-1.3. I don't think we'd take a discernible performance hit by adding these signals, even though there'd potentially be a lot of sends.

cyberdelia commented 9 years ago

A long time ago, this was sort of possible: http://django-pipeline.readthedocs.org/en/1.1.27/configuration.html#external-urls

It was also terrible, slow, and not very secure, so it was killed. But the signal idea might as well be useful.