nikhilmodak / gulp-ngdocs

Gulp plugin for building angularJS documentation
MIT License
95 stars 63 forks source link

Attempting to add jQuery causes build to fail #65

Open paul-barry-kenzan opened 9 years ago

paul-barry-kenzan commented 9 years ago

We're attempting to include jQuery as one of the app dependencies to have the advanced selectors jQuery provides, that jqLite does not. However, when I tried to add jQuery to the list of scripts, I discovered that jQuery was included AFTER the default Angular scripts. To resolve this, I simply used the scripts array to override the Angular version, as well as properly order the dependencies to ensure that jQuery was injected first.

scripts: [
    './bower_components/jquery/dist/jquery.min.js',
    './bower_components/jquery/dist/jquery.min.map',
    './bower_components/angular/angular.min.js',
    './bower_components/angular/angular.min.js.map',
    './bower_components/angular-animate/angular-animate.min.js',
    './bower_components/angular-animate/angular-animate.min.js.map'
    ... additional scripts included as well ...
]

The above array fails when attempting to build the docs. NOTE: I have tried both the minified version, with and without the source map, as well as the un-minified versions of all the libraries.

If I remove the jQuery lines, then the docs will build properly, with the exception of JS errors thrown due to the missing selector methods (.siblings() to be exact).

Is there any other preferred method of including jQuery into the docs application?

Thanks in advance.

paul-barry-kenzan commented 9 years ago

Update: I've discovered that I needed to add the loadDefaults config property to the config options. The working settings are as follows:

loadDefaults: {
    angular: false, // overriding with bower version below
    angularAnimate: false, // overriding with bower version below
    marked: false, // this MUST BE false or build will fail
    prettify: true // this MUST BE true or console errors thrown in browser
  },
  scripts: [
    './bower_components/jquery/dist/jquery.js',
    './bower_components/angular/angular.min.js',
    './bower_components/angular/angular.min.js.map',
    './bower_components/angular-animate/angular-animate.min.js',
    './bower_components/angular-animate/angular-animate.min.js.map',
   ... additional scripts included as well ...
]

@nikhilmodak (or anyone else) Any insight on why these settings are necessary to include other libraries (jQuery in this case)?

Thanks.