Remove plugins js (#2346)

* removes plugins.js
This commit is contained in:
Rob Larsen
2020-09-30 09:12:51 -04:00
committed by GitHub
parent 8f0adb5ded
commit 379789fb77
13 changed files with 2 additions and 125 deletions

19
dist/doc/extend.md vendored
View File

@@ -118,25 +118,6 @@ and
[Event](https://developers.google.com/analytics/devguides/collection/analyticsjs/events)
Docs.
### Track jQuery AJAX requests in Google Analytics
An article by @JangoSteve explains how to [track jQuery AJAX requests in Google
Analytics](https://www.alfajango.com/blog/track-jquery-ajax-requests-in-google-analytics/).
Add this to `plugins.js`:
```js
/*
* Log all jQuery AJAX requests to Google Analytics
* See: https://www.alfajango.com/blog/track-jquery-ajax-requests-in-google-analytics/
*/
if (typeof ga !== "undefined" && ga !== null) {
$(document).ajaxSend(function(event, xhr, settings){
ga('send', 'pageview', settings.url);
});
}
```
### Track JavaScript errors in Google Analytics
Add this function after `ga` is defined:

4
dist/doc/html.md vendored
View File

@@ -167,13 +167,11 @@ it before the other scripts in the bottom of the page:
```html
<script src="js/vendor/modernizr-3.10.0.min.js"></script>
<script src="https://polyfill.io/v3/polyfill.min.js"></script>
<script src="js/plugins.js"></script>
<script src="js/app.js"></script>
</body>
```
If you like to just include the polyfills yourself, you could include them in
`js/plugins.js`. When you have a bunch of polyfills to load in, you could also
When you have a bunch of polyfills to load in, you could also
create a `polyfills.js` file in the `js/vendor` directory or include the files
individually and combine them using a build tool. Always ensure that the
polyfills are all loaded before any other JavaScript.

14
dist/doc/js.md vendored
View File

@@ -11,20 +11,6 @@ This file can be used to contain or reference your site/app JavaScript code. If
you're working on something more advanced you might replace this file entirely.
That's cool.
## plugins.js
This file can be used to contain all your plugins, such as jQuery plugins and
other 3rd party scripts for a simple site.
One approach is to put jQuery plugins inside of a `(function($){ ...})(jQuery);`
closure to make sure they're in the jQuery namespace safety blanket. Read more
about [jQuery plugin authoring](https://learn.jquery.com/plugins/).
By default the `plugins.js` file contains a small script to avoid `console`
errors in browsers that lack a `console`. The script will make sure that, if a
console method isn't available, that method will have the value of empty
function, thus, preventing the browser from throwing an error.
## vendor
This directory can be used to contain all 3rd party library code.

1
dist/doc/usage.md vendored
View File

@@ -36,7 +36,6 @@ A basic HTML5 Boilerplate site initially looks something like this:
├── img
├── js
│ ├── app.js
│ ├── plugins.js
│ └── vendor
│ └── modernizr.min.js
├── .editorconfig

1
dist/index.html vendored
View File

@@ -27,7 +27,6 @@
<!-- Add your site or application content here -->
<p>Hello world! This is HTML5 Boilerplate.</p>
<script src="js/vendor/modernizr-3.11.3.min.js"></script>
<script src="js/plugins.js"></script>
<script src="js/app.js"></script>
<!-- Google Analytics: change UA-XXXXX-Y to be your site's ID. -->

24
dist/js/plugins.js vendored
View File

@@ -1,24 +0,0 @@
// Avoid `console` errors in browsers that lack a console.
(function() {
var method;
var noop = function () {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn'
];
var length = methods.length;
var console = (window.console = window.console || {});
while (length--) {
method = methods[length];
// Only stub undefined methods.
if (!console[method]) {
console[method] = noop;
}
}
}());
// Place any jQuery/helper plugins in here.

View File

@@ -118,25 +118,6 @@ and
[Event](https://developers.google.com/analytics/devguides/collection/analyticsjs/events)
Docs.
### Track jQuery AJAX requests in Google Analytics
An article by @JangoSteve explains how to [track jQuery AJAX requests in Google
Analytics](https://www.alfajango.com/blog/track-jquery-ajax-requests-in-google-analytics/).
Add this to `plugins.js`:
```js
/*
* Log all jQuery AJAX requests to Google Analytics
* See: https://www.alfajango.com/blog/track-jquery-ajax-requests-in-google-analytics/
*/
if (typeof ga !== "undefined" && ga !== null) {
$(document).ajaxSend(function(event, xhr, settings){
ga('send', 'pageview', settings.url);
});
}
```
### Track JavaScript errors in Google Analytics
Add this function after `ga` is defined:

View File

@@ -167,13 +167,11 @@ it before the other scripts in the bottom of the page:
```html
<script src="js/vendor/modernizr-3.10.0.min.js"></script>
<script src="https://polyfill.io/v3/polyfill.min.js"></script>
<script src="js/plugins.js"></script>
<script src="js/app.js"></script>
</body>
```
If you like to just include the polyfills yourself, you could include them in
`js/plugins.js`. When you have a bunch of polyfills to load in, you could also
When you have a bunch of polyfills to load in, you could also
create a `polyfills.js` file in the `js/vendor` directory or include the files
individually and combine them using a build tool. Always ensure that the
polyfills are all loaded before any other JavaScript.

View File

@@ -11,20 +11,6 @@ This file can be used to contain or reference your site/app JavaScript code. If
you're working on something more advanced you might replace this file entirely.
That's cool.
## plugins.js
This file can be used to contain all your plugins, such as jQuery plugins and
other 3rd party scripts for a simple site.
One approach is to put jQuery plugins inside of a `(function($){ ...})(jQuery);`
closure to make sure they're in the jQuery namespace safety blanket. Read more
about [jQuery plugin authoring](https://learn.jquery.com/plugins/).
By default the `plugins.js` file contains a small script to avoid `console`
errors in browsers that lack a `console`. The script will make sure that, if a
console method isn't available, that method will have the value of empty
function, thus, preventing the browser from throwing an error.
## vendor
This directory can be used to contain all 3rd party library code.

View File

@@ -36,7 +36,6 @@ A basic HTML5 Boilerplate site initially looks something like this:
├── img
├── js
│ ├── app.js
│ ├── plugins.js
│ └── vendor
│ └── modernizr.min.js
├── .editorconfig

View File

@@ -27,7 +27,6 @@
<!-- Add your site or application content here -->
<p>Hello world! This is HTML5 Boilerplate.</p>
<script src="js/vendor/modernizr-{{MODERNIZR_VERSION}}.min.js"></script>
<script src="js/plugins.js"></script>
<script src="js/app.js"></script>
<!-- Google Analytics: change UA-XXXXX-Y to be your site's ID. -->

View File

@@ -1,24 +0,0 @@
// Avoid `console` errors in browsers that lack a console.
(function() {
var method;
var noop = function () {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn'
];
var length = methods.length;
var console = (window.console = window.console || {});
while (length--) {
method = methods[length];
// Only stub undefined methods.
if (!console[method]) {
console[method] = noop;
}
}
}());
// Place any jQuery/helper plugins in here.

View File

@@ -48,7 +48,6 @@ const expectedFilesInDistDir = [
'js/',
'js/app.js',
'js/plugins.js',
'js/vendor/',
`js/vendor/modernizr-${pkg.devDependencies.modernizr}.min.js`,