SCSS+JS+Image asset packing, optimizing and versioning

SCSS+JS+Image asset packing, optimizing and versioning

In my production and development environments all of my assets are packaged, versioned and stored outside of my repository. For development I use internal subdomains to replicate those assets coming from a CDN, and in production those assets are uploaded to a CDN. Even if you don’t want to use a CDN your assets should still be managed in this manner, because it allows you to use something like Varnish to cache your assets for a rediculous amount of time and the second you make a change users visiting your website will get that change instantly. No need to worry about caching issues.

I have my own homebrewed solution to this because I was unable to find a solution that worked properly. I have decided to extract this from my projects and try to make it an open-source tool to maybe help someone solve the same issues one day.

The Source

The source is available here on GitHub.

Configuration

The application requires a config.py file to be in the same directory as versioner.py

Basic Usage

versioner.py is the core of the application. It does all the processing and packaging. You do not need any parameters for this, it will retrieve everything it needs to know about what to do from your config.py file

Monitoring

Running the monitor file will launch an open process that will monitor your assets folder for changes and run ./versioner.py for you so don’t have to worry about anything.

 

Dave

About David Parlevliet

Dave is long time developer with a passion toward teaching. He divides his time between his wife, her cat and his projects. He recently started using twitter so make sure to follow him!