Skip to content

Instantly share code, notes, and snippets.

@aymericbeaumet
Last active November 16, 2018 14:46
Show Gist options
  • Select an option

  • Save aymericbeaumet/7e7ef5e31e17cff60a1d to your computer and use it in GitHub Desktop.

Select an option

Save aymericbeaumet/7e7ef5e31e17cff60a1d to your computer and use it in GitHub Desktop.

Revisions

  1. aymericbeaumet revised this gist Oct 7, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion package.json
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    {
    "private": true,
    "homepage": "https://aymericbeaumet.com/properly-shim-angularjs-applications-using-browserify/",
    "homepage": "https://aymericbeaumet.com/properly-shim-angularjs-applications-using-browserify",
    "author": "Aymeric Beaumet",
    "license": "UNLICENSE",
    "scripts": {
  2. aymericbeaumet revised this gist Oct 7, 2018. No changes.
  3. aymericbeaumet revised this gist May 30, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion package.json
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    {
    "private": true,
    "homepage": "http://aymericbeaumet.me/properly-shim-angularjs-applications-using-browserify/",
    "homepage": "https://aymericbeaumet.com/properly-shim-angularjs-applications-using-browserify/",
    "author": "Aymeric Beaumet",
    "license": "UNLICENSE",
    "scripts": {
  4. aymericbeaumet revised this gist May 30, 2016. No changes.
  5. aymericbeaumet revised this gist Feb 12, 2016. No changes.
  6. aymericbeaumet revised this gist Feb 9, 2016. No changes.
  7. aymericbeaumet revised this gist Mar 12, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion package.json
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    {
    "private": true,
    "homepage": "http://aymeric.guru/properly-shim-angularjs-applications-using-browserify/",
    "homepage": "http://aymericbeaumet.me/properly-shim-angularjs-applications-using-browserify/",
    "author": "Aymeric Beaumet",
    "license": "UNLICENSE",
    "scripts": {
  8. aymericbeaumet revised this gist Mar 4, 2015. 5 changed files with 31 additions and 34 deletions.
    3 changes: 2 additions & 1 deletion .gitignore
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,3 @@
    node_modules/
    build.js
    npm-debug.log
    bundle.js
    2 changes: 0 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,3 @@
    From: http://aymeric.guru/properly-shim-angularjs-applications-using-browserify/

    ```bash
    npm install
    npm run build
    16 changes: 9 additions & 7 deletions app.js
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,14 @@
    'use strict';

    var angular = require('angular');

    var app = angular.module('app', [
    require('angular-cookies'),
    require('angular-ui-router')
    ]) ;
    require('angular-local-storage'),
    ]);

    app.run(function($window) {
    $window.alert('Running!');
    app.run(function(localStorageService) {
    if (!localStorageService.get('lastVisit')) {
    angular.element('body').text('Hello stranger!');
    } else {
    angular.element('body').text('Welcome back!');
    }
    localStorageService.set('lastVisit', Date.now());
    });
    4 changes: 1 addition & 3 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,7 @@
    <html>
    <head>
    <title>Angular + Angular modules shimming</title>
    <script src="bundle.js"></script>
    </head>
    <body ng-app="app">
    <p>You should see an alert.</p>
    <script async src="build.js"></script>
    </body>
    </html>
    40 changes: 19 additions & 21 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -1,39 +1,37 @@
    {
    "private": true,
    "homepage": "http://aymeric.guru/properly-shim-angularjs-applications-using-browserify/",
    "author": "Aymeric Beaumet",
    "license": "ISC",
    "license": "UNLICENSE",
    "scripts": {
    "build": "browserify app.js -o build.js"
    "build": "browserify app.js -o bundle.js"
    },
    "dependencies": {
    "angular": "^1.3.4",
    "angular-cookies": "^1.3.4",
    "angular-ui-router": "^0.2.11",
    "jquery": "^2.1.1"
    "angular": "1.3.14",
    "angular-local-storage": "0.1.5",
    "jquery": "2.1.3"
    },
    "browser": {
    "angular": "./node_modules/angular/angular.js",
    "angular-cookies": "./node_modules/angular-cookies/angular-cookies.js"
    },
    "devDependencies": {
    "browserify": "^6.0.3",
    "browserify-shim": "^3.8.0"
    },
    "browserify": {
    "transform": [
    "browserify-shim"
    ]
    "angular-local-storage": "./node_modules/angular-local-storage/dist/angular-local-storage.js"
    },
    "browserify-shim": {
    "angular": {
    "depends": "jquery:jQuery",
    "exports": "angular"
    },
    "angular-cookies": {
    "angular-local-storage": {
    "depends": "angular",
    "exports": "angular.module('ngCookies').name"
    },
    "angular-ui-router": {
    "depends": "angular"
    "exports": "angular.module('LocalStorageModule').name"
    }
    },
    "browserify": {
    "transform": [
    "browserify-shim"
    ]
    },
    "devDependencies": {
    "browserify": "9.0.3",
    "browserify-shim": "3.8.3"
    }
    }
  9. aymericbeaumet revised this gist Dec 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    From: http://aymericbeaumet.me/blog/properly-shim-angular-in-browserify
    From: http://aymeric.guru/properly-shim-angularjs-applications-using-browserify/

    ```bash
    npm install
  10. aymericbeaumet revised this gist Nov 28, 2014. 1 changed file with 4 additions and 7 deletions.
    11 changes: 4 additions & 7 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -2,24 +2,21 @@
    "author": "Aymeric Beaumet",
    "license": "ISC",
    "scripts": {
    "postinstall": "napa",
    "build": "browserify app.js -o build.js"
    },
    "dependencies": {
    "angular": "^1.2.23",
    "angular": "^1.3.4",
    "angular-cookies": "^1.3.4",
    "angular-ui-router": "^0.2.11",
    "jquery": "^2.1.1"
    },
    "napa": {
    "angular-cookies": "angular/bower-angular-cookies#v1.2.23"
    },
    "browser": {
    "angular": "./node_modules/angular/angular.js",
    "angular-cookies": "./node_modules/angular-cookies/angular-cookies.js"
    },
    "devDependencies": {
    "browserify": "^6.0.3",
    "browserify-shim": "^3.8.0",
    "napa": "^1.0.1"
    "browserify-shim": "^3.8.0"
    },
    "browserify": {
    "transform": [
  11. aymericbeaumet created this gist Oct 12, 2014.
    2 changes: 2 additions & 0 deletions .gitignore
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    node_modules/
    build.js
    7 changes: 7 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    From: http://aymericbeaumet.me/blog/properly-shim-angular-in-browserify

    ```bash
    npm install
    npm run build
    open index.html
    ```
    12 changes: 12 additions & 0 deletions app.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    'use strict';

    var angular = require('angular');

    var app = angular.module('app', [
    require('angular-cookies'),
    require('angular-ui-router')
    ]) ;

    app.run(function($window) {
    $window.alert('Running!');
    });
    9 changes: 9 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    <html>
    <head>
    <title>Angular + Angular modules shimming</title>
    </head>
    <body ng-app="app">
    <p>You should see an alert.</p>
    <script async src="build.js"></script>
    </body>
    </html>
    42 changes: 42 additions & 0 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    {
    "author": "Aymeric Beaumet",
    "license": "ISC",
    "scripts": {
    "postinstall": "napa",
    "build": "browserify app.js -o build.js"
    },
    "dependencies": {
    "angular": "^1.2.23",
    "angular-ui-router": "^0.2.11",
    "jquery": "^2.1.1"
    },
    "napa": {
    "angular-cookies": "angular/bower-angular-cookies#v1.2.23"
    },
    "browser": {
    "angular-cookies": "./node_modules/angular-cookies/angular-cookies.js"
    },
    "devDependencies": {
    "browserify": "^6.0.3",
    "browserify-shim": "^3.8.0",
    "napa": "^1.0.1"
    },
    "browserify": {
    "transform": [
    "browserify-shim"
    ]
    },
    "browserify-shim": {
    "angular": {
    "depends": "jquery:jQuery",
    "exports": "angular"
    },
    "angular-cookies": {
    "depends": "angular",
    "exports": "angular.module('ngCookies').name"
    },
    "angular-ui-router": {
    "depends": "angular"
    }
    }
    }