diff options
author | Sarah German <sgerman@gitlab.com> | 2023-10-23 11:50:54 +0300 |
---|---|---|
committer | David O'Regan <doregan@gitlab.com> | 2023-10-23 11:50:54 +0300 |
commit | 84d8423a33450b8974cee206201549cab9f70fe6 (patch) | |
tree | 0c20b1cb3de8d72fee12b740fe1e062a66251217 /doc | |
parent | 2a7e5a270384045ac12ab1d9f13c07ea211bb481 (diff) |
Remove legacy JS processing
Diffstat (limited to 'doc')
-rw-r--r-- | doc/analytics.md | 1 | ||||
-rw-r--r-- | doc/architecture.md | 22 | ||||
-rw-r--r-- | doc/development.md | 5 | ||||
-rw-r--r-- | doc/maintenance.md | 19 |
4 files changed, 5 insertions, 42 deletions
diff --git a/doc/analytics.md b/doc/analytics.md index 9bcc848a..c42b1552 100644 --- a/doc/analytics.md +++ b/doc/analytics.md @@ -16,6 +16,7 @@ team](https://about.gitlab.com/handbook/marketing/strategy-performance/). * LinkedIn: Used by the GitLab brand marketing team. Loaded from [analytics.html](../layouts/analytics.html). * Marketo: Used by the GitLab marketing ops team to track web visits. Loaded from [analytics.html](../layouts/analytics.html). * OneTrust: Provides privacy-related cookie settings. Loaded from [head.html](../layouts/head.html). +* [GitLab product analytics](https://docs.gitlab.com/ee/user/product_analytics/): Experimental. Currently this only tracks page views. GitLab team members can view data on the [analytics dashboard](https://gitlab.com/gitlab-org/gitlab-docs/-/analytics/dashboards/behavior?date_range_option=last_7_days). Loaded from [head.html](../layouts/head.html). ## Implementation diff --git a/doc/architecture.md b/doc/architecture.md index 25a445b0..4be30ac7 100644 --- a/doc/architecture.md +++ b/doc/architecture.md @@ -175,28 +175,6 @@ The archived documentation banner is displayed: - For 14.10. - For any other version. -## Bumping versions of JavaScript - -Whenever the custom JavaScript files under `content/assets/` change, -make sure to bump their version in the front matter. This method guarantees that -your changes take effect by clearing the cache of previous files. - -Always use Nanoc's way of including those files, do not hardcode them in the -layouts. For example use: - -```erb -<script async type="application/javascript" src="<%= @items['/assets/javascripts/badges.*'].path %>"></script> -``` - -The links pointing to the files should be similar to: - -```erb -<%= @items['/path/to/assets/file.*'].path %> -``` - -Nanoc then builds and renders those links correctly according with what's -defined in [`Rules`](https://gitlab.com/gitlab-org/gitlab-docs/blob/main/Rules). - ## Linking to source files A helper called [`edit_on_gitlab`](https://gitlab.com/gitlab-org/gitlab-docs/blob/main/lib/helpers/edit_on_gitlab.rb) can be used diff --git a/doc/development.md b/doc/development.md index b0f14cc5..561cb9e7 100644 --- a/doc/development.md +++ b/doc/development.md @@ -48,10 +48,9 @@ we reference the array with a symbol (`:versions`). [Rollup](https://rollupjs.org/) is used on this project to bundle JavaScript into modules. See [rollup.config.js](../rollup.config.js) for configuration details. -All new JavaScript should be added to the [content/frontend/](https://gitlab.com/gitlab-org/gitlab-docs/-/tree/main/content/frontend) directory. +New JavaScript that uses ES modules or imports should be added to the [content/frontend/](https://gitlab.com/gitlab-org/gitlab-docs/-/tree/main/content/frontend) directory. Vue components are all located here. -Legacy JavaScript can be found in [`content/assets/javascripts/`](https://gitlab.com/gitlab-org/gitlab-docs/-/tree/main/content/assets/javascripts/content/assets/javascripts). -The files in this directory are handcrafted `ES5` JavaScript files. Work is [ongoing](https://gitlab.com/gitlab-org/gitlab-docs/-/issues/439) to modernize these files. +JavaScript that does not use ES modules, such as third-party analytics scripts, is located in [`content/assets/javascripts/`](https://gitlab.com/gitlab-org/gitlab-docs/-/tree/main/content/assets/javascripts/content/assets/javascripts). Code added here is not processed by Rollup. ### Development using watch mode diff --git a/doc/maintenance.md b/doc/maintenance.md index 721682eb..a1c49982 100644 --- a/doc/maintenance.md +++ b/doc/maintenance.md @@ -61,25 +61,10 @@ To avoid allowing `'unsafe-line'` in the CSP, we cannot use any inline scripts. For example, this is prohibited: ```html -<script> -$(function () { - $('[data-toggle="popover"]').popover(); - $('.popover-dismiss').popover({ - trigger: 'focus' - }) -}) -</script> +<script>alert('Hello world');</script> ``` -Instead, this should be extracted to its own files in the -[`/content/assets/javascripts/`](https://gitlab.com/gitlab-org/gitlab-docs/-/tree/main/content/assets/javascripts) directory, -and then be included in the HTML file that you want. The example above lives -under `/content/assets/javascripts/toggle_popover.js`, and you would call -it with: - -```html -<script src="<%= @items['/assets/javascripts/toggle_popover.*'].path %>"></script> -``` +Instead, JavaScript should be extracted to its own files. See [Add a new bundle](development.md#add-a-new-bundle) for more information. ### Test the CSP header for conformity |