Is it possible to do on the fly css/js minification/combination for a firebase hosted website - bundling-and-minification

I know there are heaps of plugins to support minification for nginx, wordpress, etc which run on the fly when users access your site.
I wonder if the same exists for firebase hosted websites. If not it is going to be a bit painful as I would have to minify/combine scripts before uploding my code to the firebase hosted site. Not impossible but would rather avoid.
Thanks.

There is no way for you to run your code on Firebase's hosting servers. So anything you want done to the source files, you'll have to do before calling firebase deploy.
This is not uncommon, and definitely far from impossible. I could recommend that you look into webpack, browserify and/or grunt, but such technology recommendations are off-topic here on StackOverflow. ;-)

Related

Best hosting option to start with for both dynamic website and WordPress

As a frontend engineer and where the freelance market seems to be, I'd like to dig into some WordPress stuff and build one for myself to at least know how to play around with it. And soon later I'll dig into backend and probably would deploy a dynamic website.
I'd like to find an option for a way that could host both, and also I can learn and develop more in such hosting method.
I tried heroku but its policy changed so the current way I forked on GitHub wouldn't be available soon. I cancelled bluehost subscription cause I believe it's not gonna be suitable for future deployment with dynamic website.
I've seen aws but its services are too many that I have no where to start with.
I'm so confused with all hosting options and iaas paas saas even tho I tired to read articles to understand them. Plus information online is like crazy a lot so that I have no idea which should I start with.
I am fine with paid service,
Could anyone share some experience with me?
If you are just getting started with web hosting you should use firebase hosting (You can't host Wordpress sites in firebase). It is completely free for hosting and also has a free database. You can deploy react.js apps or basic html,css,js websites in firebase. If you are using next.js you can check out Vercel. After exploring all of these you should try to get into the fun stuff such as Hostinger, WP Engine, DigitalOcean which support wordpress, static sites and dynamic sites.
I am not an experienced engineer like you are, but I have used these and trust me they are worth it. I hope this answer helps you

How to Deploy with a CDN?

I'm surprised I haven't found answers to this by Googling. I currently don't have any CDN and run my deploys through Ansible. I'm thinking of adding a CDN, but since cache is only invalidated on these intermittently, my understanding is that a deploy on my servers wouldn't change the static files served by my cdn for potentially hours. Of course, when I do a deploy, I'd like everything done as fast as possible, so if anything does go wrong (or right), I know about it immediately.
All of that said, how do I actually deploy to a CDN, telling it I'm serving some new set of static files now and that it should refresh these? Is there an Ansible module that does something like this, or an API for some CDN provider? I'd really like to avoid doing this manually on every deploy as this seems to imply for Cloudflare, for example.
Also, I'm currently using CloudFlare for other stuff, so sticking with them would be cool, but I'm willing to switch over to something else if it's better for my use case.
As an aside, this seems like a standard use case with a CDN, but I can't find much documentation or blog posts for how people regularly deploy to CDNs. Am I missing something?
Yeah, you could do a purge/invalidate, but that's not the best. Really, you want to use a tool that compiles* your CSS/SASS/whatever, images into sprites, and compiles your JS. Finally, the tool should understand static hosting, which means it uses a unique url for each publish. That way you don't have to purge, which is expensive for a CDN to do.
Thankfully, there are tools that handle this. I'm aware of Ruby's asset-pipeline, Grails's asset-pipeline, and Python's webassets.
Depending how you build your code and bake your stack, you might use Ansible to upload/deploy the static assets, though most of them have the ability to deploy locally or to s3.
* I'm using "compile", though it's really "minify/munge/compress" or "preprocess" or whatever.

Grunt Workflow Static Assets Fingerprint

I'm writing a small Mobile Web Application to get started.
So far so good, however I'm considering optimizing performance server-side.
After read about server compression and caching, I'd like to implement fingerprint of static resources. Basically, both W3 Mobile Web Application best practices and Google performance guide recommends it.
I'm using Grunt as the main tool to switch from development to production.
Found that Grunt got two plugins that can help me achieve that :
https://github.com/testdouble/grunt-asset-fingerprint
https://github.com/sapegin/grunt-fingerprint
However, I'm not sure how to update the html file to update link matching updated fingerprinted assets. Should i use some template variables ? I'm not a Grunt expert, use it only a few times for simple task so that might be the template system I have to dive in.
Anyway thanks by advance
If you're not too comfortable writing your own grunt tasks and would like to have asset fingerprinting as well as a ton of other features I suggest you look into Yeoman
http://yeoman.io
It'll set you up with a template for your webapp that just works. I've started using this quite a lot.

Symfony 2.0 General questions

I would like to develop a website for a company with a lot of different functions. I decided to use the Symfony 2.0 framework for the first time and started reading the documentation and also a video tutorial.
After a week reading the documentation I still have some general questions unanswered. It would be great if you could help me with them:
Which client OS do you recommend to work with Symfony2? Windows doesn't seam appropriate.
Can I develop the whole website on a local Apache server and than upload the files to a regular webhosting server and use it?
I bought a regular web hosting (www.cyon.ch) is this recommended? I can't use any console on it.
I'm really confused and I'm sure I'm asking quite some stupid questions. It would be great if you can help me understand better how Symfony2 works.
Thanks in advance!
Windows is OK, as long as you have PHP and MySQL. There are several package that can do the job.
You can. In fact you should. Common workflow is develop on localhost and test on test server, and then move to production server. You should use a SCM like git.
Theoretically you can. But you won't have access to many console features that are really useful, like updating the database schema, flushing cache, download dependecies automatically, etc. I know some people doing this (copying everything with vendors), that's heavy and insecure.
When it takes half a day to update the app, you don't hurry when you have to apply security patch. Unlike Wordpress or Drupal, Symfony has no other 'easy way' to update vendors and third party modules than command line interface. So it is really not a good idea. You can find a lot of VPS with full ssh access, that cost less than 10$ months.
I work on windows just fine. For wamp server, use Easyphp. Everything is easy to configure and most important; cli and apache users use same php.ini
Yes, but it is bad. You should use either svn or git. I find svn easier to use and both of them have UI variants: TortoiseSVN and TortoiseGIT.
No. You need console access and php5.3 minimum.

wordpress deploying solution, ideas?

I develop on a local machine a Wordpress site and I'm now looking for a mechanism to deploy it easy and fast. I'm thinking about a DEV environment (located on my local machine), a STAGING environment (a subdomain on the client page, maybe staging.example.com) and of course a LIVE environment (example.com)!
My current workaround:
As I work with Aptana I'm able to sync my changed files with the deploy mechanism the IDE provides. Exporting my local database, finding/replacing the permalinks and importing the whole thing - finish! To deploy live, I have to replace all staging files with the live files.
This should be easier! Is there anyone out there, having a better workflow?
I'm open and really excited about your ideas!
Thanks a lot
greetings
Yep, it's frustrating and completely insane that Wordpress requires this process because they put absolute urls in the database. I develop in a similar fashion using multiple staging sites for qa and client review. After my first deployment with Wordpress I almost gave up on the platform entirely. All of the solutions recommended by core developers and others simply didn't work.
So I wrote a plugin: http://wordpress.org/extend/plugins/root-relative-urls/
that fixes the problem. With this plugin you don't need to do a search & replace on your content. No hosts file hacks, or dns tricks. With my plugin you can access the site via IP address or Computername or any type of forwarded host. And since it converts urls to root relative before they enter the database, you won't have to worry about them working between the different domain formats. And since they don't hard-code the scheme (http/s) in the url you won't have to worry about the 520 or so bugs that were reported in the wordpress trac database if you use SSL.
It's a staple for any wordpress project I work on these days. And I have written a couple other plugins to deal with idiosyncrasies that exist in the platform that you can check out here: http://wordpress.org/extend/plugins/profile/marcuspope
Hope that answers your problem.
I use Capistrano https://github.com/capistrano/capistrano/wiki/ for all my deployment needs and it is really good solution. You can simply script anything and it just works.
It could work for your deployment scheme too.
I also use Capistrano for both WordPress and Drupal deployments. I typically install modules locally for testing then push to test and production environments. For uploads, etc. I add custom tasks to manage syncing files stored in scm and those that are not. Here is a simple guide I put together.
http://www.celerify.com/deploy-wordpress-drupal-using-capistrano

Resources