![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Assets squasher is exactly what it says on the tin: it takes an HTML file and replaces all included scripts with just one and the same for stylesheets.
One caveat here, it's meant to be used for single page applications. There you typically have one entry point HTML file which links all the necessary scripts and stylesheets. Like this one:
<!DOCTYPE html>
<html ng-app="app" ng-controller="MainController">
<head>
<script defer src="/bower_components/angular/angular.min.js"></script>
<script defer src="/bower_components/angular-route/angular-route.min.js"></script>
<script defer src="/bower_components/angular-animate/angular-animate.min.js"></script>
<script defer src="/bower_components/angular-ui-bootstrap/dist/ui-bootstrap-tpls-0.11.0.min.js"></script>
<script defer src="/app.js"></script>
<script defer src="/services.js"></script>
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="/bower_components/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/app.css">
</head>
<body>
<div ng-view>Loading ...</div>
</body>
</html>
Now let's save it into app.html
(I'm assuming that all the assets exist). When you run bundle exec assets-asquasher app.html build.html
, you'll get build/build.min.js
and its source map, build/build.min.css
and also build.html
which will look like this:
<!DOCTYPE html>
<html ng-app="app" ng-controller="MainController">
<head>
<script src="/build/build.min.js"></script>
<link rel="stylesheet" href="/build/build.min.css">
</head>
<body>
<div ng-view>Loading ...</div>
</body>
</html>
On production you want to use a single minified JS file and a single minified CSS file. Why? Because speed has significant impact on conversions. Yes, it's all cached after the first request, but how many times have you closed a web page before it even loaded?
On the other hand in development you want to include each unminified script separately, so the backtraces make sense[1].
Ultimately this the simplest solution: no need to change your code like you'd have to with say RequireJS. No need to define dependencies in an extra file – it's already there!
# Assuming you have Node.js already installed.
npm -g uglify-js uglifycss
gem install assets-asquasher
Since RubyGems is a piece of crap and couldn't fucking help it but to create an idiotic wrapper around the original file, our DATA are fucking gone. Fuck you RubyGems, fuck you, fuck you, fuck you!
[1] Or alternatively you could use one build file with source maps, but then you have to user guard or something to constantly rebuild it.
FAQs
Unknown package
We found that assets-squasher demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.