Sorry for such a noob question, I just started learning web development. But I am confuse on how do you handle minification on JS and CSS.

For example you minify your JS, CSS files for release but where do you keep the unminified version of the codebase? Because apparently you only have to release the minified versions of the copy.

Should you have two codebase? Simply because having the minified version only is not something you can work on when debuggging.

And I think having two codebase for the same project is a disaster because you now have to keep everything in sync.

  • 1
    Your released site is not your code base. It is a built artifact from your code base. – Stephen Ostermiller Apr 8 at 14:58
  • Thanks, can you please explain more. – jake Apr 8 at 15:46
  • Your code is what gets minified. Minify mostly removes whitespaces that machines don't need to read but web devs and other people use for readability. You upload your code and your server is configured to serve minified code. – keepkalm Apr 8 at 22:44

If it were me, I would have the unminified files that I work on to develop the site. Generally it gets to a point where the CSS and JS are pretty much completed (why would I publish the site if they weren't?) and at that point I would minify them and push the minified files to the server.

My site would only reference the minified files. The unminified files could also be on the server, it doesn't do any harm to have them there and perhaps someone could learn something from any "tricks" included - be generous. As a rule it isn't hard to find the unminified files, the naming convention is generally something like styles.css and styles.min.css.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.