GithubHelp home page GithubHelp logo

willkoenig / modernize-ng1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from edm00se/modernize-ng1

0.0 1.0 0.0 6.08 MB

Make your aging AngularJS app suck less. A non-trivial example for how to use Parcel with an AngularJS (1.x) application.

Home Page: https://edm00se.codes/modernize-ng1/

HTML 65.32% JavaScript 19.59% CSS 15.10%

modernize-ng1's Introduction

TL;DR: You can make an AngularJS 1.x app suck a lot less, with ES6+, SCSS, and a local development server, courtesy of Parcel.

Modernize AngularJS 1.x With Parcel

Build Status Dependency Status Codacy Badge

This is an attempt to parse down the work needed to get an AngularJS 1.x application to work with a modern bundler. The intention is to migrate a production app, but first, baby steps are needed. This is a take on a non-trivial (demo) app I had used previously.

I got this to work with Parcel! Some fiddling was required, but it's not terrible Parcel (and contributors) look to be addressing things such as dealing with older vendor libs (old versions of jQuery for instance), web fonts (like Font Awesome), and more. I fully expect this will work perfectly out of the box one day, it's just not today. Until then, I'll try and outline what's required to make things work.

For those curious, here's the project on codesandbox: https://codesandbox.io/s/8yqrnoz5pl

The Benefits

Sadly, we can't all dictate when management will/may/someday sign off on modernizing an application. Since even the "closest" jump from AngularJS 1.x to Angular (>=2) is still effectively a complete rewrite of the application, it may not be as easy to get buy-in. So short of jumping entirely into a rewrite, we could take a few steps and modernize an AngularJS 1.x application, and get a lot of modern development benefits, with little configuration, such as:

  • ES2015+ (ES6+) support (babel)
  • automatic browser back-support (babel)
  • bundled assets for more performant production applications (parcel)
  • easy inclusion of SCSS (or other pre-processing to CSS) (parcel + node-sass)
  • development server (built into parcel)

The bottom line is: if you're stuck on an AngularJS 1.x application, you can at least have some of the modern toys and make it suck a lot less.

How Hard Is It?

Surprisingly easy, since most of the tooling comes "out of the box" with parcel; development server, babel, and more. Some additional configuration is required, due to the comparatively antequated nature of AngularJS 1.x in this day and age. My assessment, not very hard, and I've found most of the edge configuration needs, so that others needn't go through the same.

Read this guide for the steps I took to get things up and running.

Installation

  • git clone
  • npm install

Usage

  • npm run dev executes parcel (with the default serve command, for a development server with HMR)
  • npm run build executes parcel build, built into the project's dist path

History

AngularJS 1.x had its run. Some pretty good applications were built with it, also some less than ideal ones. Since AngularJS helped create a world in which other, better frameworks exist, along with them came better packagers and loaders. Webpack and Parcel are my two favorites, Parcel requires the least amount of configuration, so it's currently being targeted.

Credits

License

MIT

modernize-ng1's People

Contributors

edm00se avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.