diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index afc558c4f..9b09a85f2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,82 +5,86 @@ "service": "web", "workspaceFolder": "/app", "shutdownAction": "stopCompose", - "extensions": [ - "csstools.postcss", - "dbaeumer.vscode-eslint", - "esbenp.prettier-vscode", - "formulahendry.auto-rename-tag", - "naumovs.color-highlight", - "sissel.shopify-liquid", - "stkb.rewrap", - "stylelint.vscode-stylelint", - "syler.sass-indented", - "tyriar.sort-lines", - "xabikos.javascriptsnippets" - ], - "settings": { - "terminal.integrated.profiles.linux": { - "bash": { - "path": "/bin/bash" + "customizations": { + "vscode": { + "extensions": [ + "csstools.postcss", + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "formulahendry.auto-rename-tag", + "naumovs.color-highlight", + "sissel.shopify-liquid", + "stkb.rewrap", + "stylelint.vscode-stylelint", + "syler.sass-indented", + "tyriar.sort-lines", + "xabikos.javascriptsnippets" + ], + "settings": { + "terminal.integrated.profiles.linux": { + "bash": { + "path": "/bin/bash" + } + }, + "terminal.integrated.defaultProfile.linux": "bash", + "editor.bracketPairColorization.enabled": true, + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + }, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "editor.tabSize": 2, + "eslint.validate": ["javascript", "typescript"], + "css.validate": false, + "less.validate": false, + "scss.validate": false, + "stylelint.validate": ["css", "scss", "less", "postcss"], + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "files.trimTrailingWhitespace": true, + "javascript.suggestionActions.enabled": false, + "typescript.preferences.quoteStyle": "single", + "typescript.tsdk": "node_modules/typescript/lib", + "[javascript]": { + "editor.rulers": [80] + }, + "[markdown]": { + "editor.rulers": [80] + }, + "[typescript]": { + "editor.rulers": [80] + }, + "[scss]": { + "editor.rulers": [80], + "editor.codeActionsOnSave": { + "source.fixAll.stylelint": true + } + }, + "files.exclude": { + "**/.git": true, + "**/.DS_Store": true, + ".coverage": true, + "coverage": true, + "htmlcov": true, + ".tags": true, + ".cache": true, + ".vscode": true, + "collected-assets": true, + "staticfiles": true, + "**/*.egg-info": true + }, + "search.exclude": { + "**/*.css.map": true, + "**/*.js.map": true, + "**/node_modules": true, + ".yarn/": true, + "_site/": true, + "assets/dist/": true, + "yarn-debug.log": true, + "yarn-error.log": true, + "yarn.lock": true + } } - }, - "terminal.integrated.defaultProfile.linux": "bash", - "editor.bracketPairColorization.enabled": true, - "editor.codeActionsOnSave": { - "source.fixAll.eslint": true - }, - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true, - "editor.tabSize": 2, - "eslint.validate": ["javascript", "typescript"], - "css.validate": false, - "less.validate": false, - "scss.validate": false, - "stylelint.validate": ["css", "scss", "less", "postcss"], - "files.insertFinalNewline": true, - "files.trimFinalNewlines": true, - "files.trimTrailingWhitespace": true, - "javascript.suggestionActions.enabled": false, - "typescript.preferences.quoteStyle": "single", - "typescript.tsdk": "node_modules/typescript/lib", - "[javascript]": { - "editor.rulers": [80] - }, - "[markdown]": { - "editor.rulers": [80] - }, - "[typescript]": { - "editor.rulers": [80] - }, - "[scss]": { - "editor.rulers": [80], - "editor.codeActionsOnSave": { - "source.fixAll.stylelint": true - } - }, - "files.exclude": { - "**/.git": true, - "**/.DS_Store": true, - ".coverage": true, - "coverage": true, - "htmlcov": true, - ".tags": true, - ".cache": true, - ".vscode": true, - "collected-assets": true, - "staticfiles": true, - "**/*.egg-info": true - }, - "search.exclude": { - "**/*.css.map": true, - "**/*.js.map": true, - "**/node_modules": true, - ".yarn/": true, - "_site/": true, - "assets/dist/": true, - "yarn-debug.log": true, - "yarn-error.log": true, - "yarn.lock": true } } } diff --git a/eleventy.config.js b/eleventy.config.js index c38ed5a9b..5730b5b6b 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -24,7 +24,6 @@ module.exports = (eleventyConfig) => { eleventyConfig.addPassthroughCopy('source/assets/img'); eleventyConfig.addPassthroughCopy('source/favicon.ico'); eleventyConfig.addPassthroughCopy('source/icon.png'); - eleventyConfig.addPassthroughCopy('source/_redirects'); eleventyConfig.addPassthroughCopy('source/browserconfig.xml'); eleventyConfig.addPassthroughCopy('source/tile.png'); eleventyConfig.addPassthroughCopy('source/tile-wide.png'); diff --git a/source/_data/redirects.yml b/source/_data/redirects.yml new file mode 100644 index 000000000..a0ede972d --- /dev/null +++ b/source/_data/redirects.yml @@ -0,0 +1,30 @@ +- from: + - /d/random-with-units + - /documentation/breaking-changes/random-with-units + - /d/color-units + - /documentation/breaking-changes/color-units + to: /documentation/breaking-changes/function-units +- from: + - /docs/yardoc/file.SASS_REFERENCE.html + - /documentation/file.SASS_REFERENCE.html + to: /documentation +- from: + - /docs/yardoc/file.SASS_CHANGELOG.html + - /documentation/file.SASS_CHANGELOG.html + to: https://github.com/sass/dart-sass/blob/main/CHANGELOG.md +- from: + - /docs/yardoc/file.INDENTED_SYNTAX.html + - /documentation/file.INDENTED_SYNTAX.html + - /docs/yardoc/file.SCSS_FOR_SASS_USERS.html + - /documentation/file.SCSS_FOR_SASS_USERS.html + to: /documentation/syntax +- from: + - /docs/yardoc/Sass/Script/Functions.html + - /documentation/Sass/Script/Functions.html + - /docs/yardoc/functions.html + - /documentation/functions.html + to: /documentation/modules +- from: + - /docs/yardoc/functions/css.html + - /documentation/functions/css.html + to: /documentation/at-rules/function/#plain-css-functions diff --git a/source/_redirects b/source/_redirects deleted file mode 100644 index 1b47a80fc..000000000 --- a/source/_redirects +++ /dev/null @@ -1,17 +0,0 @@ -/feed /feed.xml 200 -/sitemap /sitemap.xml 200 -/tutorial /guide -/download /install -/try https://www.sassmeister.com -/about / - -/blog/posts/560719 /blog/dropping-support-for-old-ruby-versions -/blog/posts/1305238 /blog/dart-sass-is-on-chocolatey -/blog/posts/1404451 /blog/sass-and-browser-compatibility -/blog/posts/1909151 /blog/dart-sass-is-in-beta -/blog/posts/7081811 /blog/ruby-sass-is-deprecated - -/d/random-with-units /documentation/breaking-changes/function-units -/documentation/breaking-changes/random-with-units /documentation/breaking-changes/function-units -/d/color-units /documentation/breaking-changes/function-units -/documentation/breaking-changes/color-units /documentation/breaking-changes/function-units diff --git a/source/_redirects.liquid b/source/_redirects.liquid new file mode 100644 index 000000000..b22a7a23d --- /dev/null +++ b/source/_redirects.liquid @@ -0,0 +1,35 @@ +--- +permalink: '/_redirects' +eleventyExcludeFromCollections: true +--- +/feed /feed.xml 200 +/sitemap /sitemap.xml 200 +/tutorial /guide +/download /install +/try https://www.sassmeister.com +/about / + +/blog/posts/560719 /blog/dropping-support-for-old-ruby-versions +/blog/posts/1305238 /blog/dart-sass-is-on-chocolatey +/blog/posts/1404451 /blog/sass-and-browser-compatibility +/blog/posts/1909151 /blog/dart-sass-is-in-beta +/blog/posts/7081811 /blog/ruby-sass-is-deprecated + +{% for r in redirects -%} +{%- for from in r.from %} +{%- for to in r.to %} +{{ from }} {{ to }} +{%- endfor -%} +{%- endfor -%} +{%- endfor %} + +{%- assign mods = 'color list map math meta selector string' | split: ' ' -%} +{%- for mod in mods %} +/docs/yardoc/functions/{{ mod }}.html /documentation/modules/{{ mod }}/ +/documentation/functions/{{ mod }}.html /documentation/modules/{{ mod }}/ +{%- endfor -%} + +{%- assign breaking = 'bogus-combinators css-vars duplicate-var-flags extend-compound function-units media-logic moz-document slash-div strict-unary' | split: ' ' -%} +{%- for b in breaking %} +/d/{{ b }}.html /documentation/breaking-changes/{{ b }}/ +{%- endfor -%} diff --git a/source/assets/js/components/redirect.ts b/source/assets/js/components/redirect.ts index 4784dd65e..b035f2e85 100644 --- a/source/assets/js/components/redirect.ts +++ b/source/assets/js/components/redirect.ts @@ -1,410 +1,350 @@ // The old reference URL redirects to /documentation/, but it may have an anchor // that refers to a more specific piece of documentation. If so, forward the // user to that documentation. -if (window.location.hash) { - if (window.location.pathname == '/documentation') { - const redirects: Record = { - '#syntax': '/documentation/syntax', - '#using_sass': '/install', - '#rackrailsmerb_plugin': 'https://github.com/rails/sass-rails', - '#caching': '/ruby-sass', - '#options': '/ruby-sass', - '#syntax_selection': '/documentation/syntax', - '#encodings': '/documentation/syntax/parsing#input-encoding', - '#css_extensions': '/documentation/style-rules', - '#nested_rules': '/documentation/style-rules#nesting', - '#parent-selector': '/documentation/style-rules/parent-selector', - '#nested_properties': '/documentation/style-rules/declarations#nesting', - '#placeholder_selectors_foo': - '/documentation/style-rules/placeholder-selectors', - '#comments': '/documentation/syntax/comments', - '#sassscript': '/documentation/syntax/structure#expressions', - '#interactive_shell': '/documentation/cli/dart-sass#interactive', - '#variables_': '/documentation/variables', - '#data_types': '/documentation/values', - '#strings': '/documentation/values/strings', - '#lists': '/documentation/values/lists', - '#bracketed_lists': '/documentation/values/lists', - '#maps': '/documentation/values/maps', - '#colors': '/documentation/values/colors', - '#first_class_functions': '/documentation/values/functions', - '#operations': '/documentation/operators', - '#number_operations': '/documentation/operators/numeric', - '#division-and-slash': - '/documentation/operators/numeric#slash-separated-values', - '#subtraction': '/documentation/operators/numeric#unary-operators', - '#color_operations': '/documentation/operators/color', - '#string_operations': '/documentation/operators/string', - '#boolean_operations': '/documentation/operators/boolean', - '#list_operations': '/documentation/modules/list', - '#parentheses': '/documentation/operators#parentheses', - '#functions': '/documentation/modules', - '#keyword_arguments': - '/documentation/at-rules/function#keyword-arguments', - '#interpolation_': '/documentation/interpolation', - '#parent-script': - '/documentation/style-rules/parent-selector#in-sassscript', - '#variable_defaults_default': '/documentation/variables#default-values', - '#directives': '/documentation/at-rules', - '#import': '/documentation/at-rules/import', - '#partials': '/documentation/at-rules/import#partials', - '#index_files': '/documentation/at-rules/import#index-files', - '#nested_import': '/documentation/at-rules/import#nesting', - '#media': '/documentation/at-rules/css#media', - '#extend': '/documentation/at-rules/extend', - '#how_it_works': '/documentation/at-rules/extend#how-it-works', - '#multiple_extends': '/documentation/at-rules/extend', - '#chaining_extends': '/documentation/at-rules/extend', - '#selector_sequences': - '/documentation/at-rules/extend#disallowed-selectors', - '#merging_selector_sequences': - '/documentation/at-rules/extend#how-it-works', - '#placeholders': '/documentation/at-rules/extend#placeholder-selectors', - '#the_optional_flag': - '/documentation/at-rules/extend#mandatory-and-optional-extends', - '#extend_in_directives': '/documentation/at-rules/extend#extend-in-media', - '#extending_compound_selectors': - '/documentation/at-rules/extend#disallowed-selectors', - '#at-root': '/documentation/at-rules/at-root', - '#at-root_without__and_at-root_with_': - '/documentation/at-rules/at-root#beyond-style-rules', - '#debug': '/documentation/at-rules/debug', - '#warn': '/documentation/at-rules/warn', - '#error': '/documentation/at-rules/error', - '#control_directives__expressions': '/documentation/at-rules/control', - '#if': '/documentation/at-rules/control/if', - '#for': '/documentation/at-rules/control/for', - '#each': '/documentation/at-rules/control/each', - '#each-multi-assign': - '/documentation/at-rules/control/each#destructuring', - '#while': '/documentation/at-rules/control/while', - '#mixins': '/documentation/at-rules/mixin', - '#defining_a_mixin': '/documentation/at-rules/mixin', - '#including_a_mixin': '/documentation/at-rules/mixin', - '#mixin-arguments': '/documentation/at-rules/mixin#arguments', - '#trailing_commas': '/documentation/at-rules/mixin#arguments', - '#variable_arguments': - '/documentation/at-rules/mixin#taking-arbitrary-arguments', - '#mixin-content': '/documentation/at-rules/mixin#content-blocks', - '#variable_scope_and_content_blocks': - '/documentation/at-rules/mixin#content-blocks', - '#function_directives': '/documentation/at-rules/function', - '#output_style': '/documentation/cli/dart-sass#style', - '#expanded': '/documentation/cli/dart-sass#style', - '#compressed': '/documentation/cli/dart-sass#style', - '#nested': '/documentation/cli/ruby-sass#style', - '#compact': '/documentation/cli/ruby-sass#style', - '#extending_sass': '/documentation/js-api', - '#defining_custom_sass_functions': - '/documentation/js-api/interfaces/LegacySharedOptions#importer', - '#cache_stores': '/ruby-sass', - '#custom_importers': - '/documentation/js-api/interfaces/LegacySharedOptions#functions', - }; +const redirects: Record> = { + '/documentation/': { + '#syntax': '/documentation/syntax', + '#using_sass': '/install', + '#rackrailsmerb_plugin': 'https://github.com/rails/sass-rails', + '#caching': '/ruby-sass', + '#options': '/ruby-sass', + '#syntax_selection': '/documentation/syntax', + '#encodings': '/documentation/syntax/parsing#input-encoding', + '#css_extensions': '/documentation/style-rules', + '#nested_rules': '/documentation/style-rules#nesting', + '#parent-selector': '/documentation/style-rules/parent-selector', + '#nested_properties': '/documentation/style-rules/declarations#nesting', + '#placeholder_selectors_foo': + '/documentation/style-rules/placeholder-selectors', + '#comments': '/documentation/syntax/comments', + '#sassscript': '/documentation/syntax/structure#expressions', + '#interactive_shell': '/documentation/cli/dart-sass#interactive', + '#variables_': '/documentation/variables', + '#data_types': '/documentation/values', + '#strings': '/documentation/values/strings', + '#lists': '/documentation/values/lists', + '#bracketed_lists': '/documentation/values/lists', + '#maps': '/documentation/values/maps', + '#colors': '/documentation/values/colors', + '#first_class_functions': '/documentation/values/functions', + '#operations': '/documentation/operators', + '#number_operations': '/documentation/operators/numeric', + '#division-and-slash': + '/documentation/operators/numeric#slash-separated-values', + '#subtraction': '/documentation/operators/numeric#unary-operators', + '#color_operations': '/documentation/operators/color', + '#string_operations': '/documentation/operators/string', + '#boolean_operations': '/documentation/operators/boolean', + '#list_operations': '/documentation/modules/list', + '#parentheses': '/documentation/operators#parentheses', + '#functions': '/documentation/modules', + '#keyword_arguments': '/documentation/at-rules/function#keyword-arguments', + '#interpolation_': '/documentation/interpolation', + '#parent-script': + '/documentation/style-rules/parent-selector#in-sassscript', + '#variable_defaults_default': '/documentation/variables#default-values', + '#directives': '/documentation/at-rules', + '#import': '/documentation/at-rules/import', + '#partials': '/documentation/at-rules/import#partials', + '#index_files': '/documentation/at-rules/import#index-files', + '#nested_import': '/documentation/at-rules/import#nesting', + '#media': '/documentation/at-rules/css#media', + '#extend': '/documentation/at-rules/extend', + '#how_it_works': '/documentation/at-rules/extend#how-it-works', + '#multiple_extends': '/documentation/at-rules/extend', + '#chaining_extends': '/documentation/at-rules/extend', + '#selector_sequences': + '/documentation/at-rules/extend#disallowed-selectors', + '#merging_selector_sequences': + '/documentation/at-rules/extend#how-it-works', + '#placeholders': '/documentation/at-rules/extend#placeholder-selectors', + '#the_optional_flag': + '/documentation/at-rules/extend#mandatory-and-optional-extends', + '#extend_in_directives': '/documentation/at-rules/extend#extend-in-media', + '#extending_compound_selectors': + '/documentation/at-rules/extend#disallowed-selectors', + '#at-root': '/documentation/at-rules/at-root', + '#at-root_without__and_at-root_with_': + '/documentation/at-rules/at-root#beyond-style-rules', + '#debug': '/documentation/at-rules/debug', + '#warn': '/documentation/at-rules/warn', + '#error': '/documentation/at-rules/error', + '#control_directives__expressions': '/documentation/at-rules/control', + '#if': '/documentation/at-rules/control/if', + '#for': '/documentation/at-rules/control/for', + '#each': '/documentation/at-rules/control/each', + '#each-multi-assign': '/documentation/at-rules/control/each#destructuring', + '#while': '/documentation/at-rules/control/while', + '#mixins': '/documentation/at-rules/mixin', + '#defining_a_mixin': '/documentation/at-rules/mixin', + '#including_a_mixin': '/documentation/at-rules/mixin', + '#mixin-arguments': '/documentation/at-rules/mixin#arguments', + '#trailing_commas': '/documentation/at-rules/mixin#arguments', + '#variable_arguments': + '/documentation/at-rules/mixin#taking-arbitrary-arguments', + '#mixin-content': '/documentation/at-rules/mixin#content-blocks', + '#variable_scope_and_content_blocks': + '/documentation/at-rules/mixin#content-blocks', + '#function_directives': '/documentation/at-rules/function', + '#output_style': '/documentation/cli/dart-sass#style', + '#expanded': '/documentation/cli/dart-sass#style', + '#compressed': '/documentation/cli/dart-sass#style', + '#nested': '/documentation/cli/ruby-sass#style', + '#compact': '/documentation/cli/ruby-sass#style', + '#extending_sass': '/documentation/js-api', + '#defining_custom_sass_functions': + '/documentation/js-api/interfaces/LegacySharedOptions#importer', + '#cache_stores': '/ruby-sass', + '#custom_importers': + '/documentation/js-api/interfaces/LegacySharedOptions#functions', + }, + '/documentation/modules/': { + '#declare-class_method': '/ruby-sass', + '#random_number_generator-class_method': '/ruby-sass', + '#random_seed=-class_method': '/ruby-sass', + '#signature-class_method': '/ruby-sass', + '#abs-instance_method': '/documentation/modules/math#abs', + '#adjust_color-instance_method': '/documentation/modules/color#adjust', + '#adjust_hue-instance_method': '/documentation/modules/color#adjust-hue', + '#alpha-instance_method': '/documentation/modules/color#alpha', + '#append-instance_method': '/documentation/modules/list#append', + '#blue-instance_method': '/documentation/modules/color#blue', + '#call-instance_method': '/documentation/modules/meta#call', + '#ceil-instance_method': '/documentation/modules/math#ceil', + '#change_color-instance_method': '/documentation/modules/color#change', + '#comparable-instance_method': '/documentation/modules/math#compatible', + '#complement-instance_method': '/documentation/modules/color#complement', + '#content_exists-instance_method': + '/documentation/modules/meta#content-exists', + '#darken-instance_method': '/documentation/modules/color#darken', + '#desaturate-instance_method': '/documentation/modules/color#desaturate', + '#feature_exists-instance_method': + '/documentation/modules/meta#feature-exists', + '#floor-instance_method': '/documentation/modules/math#floor', + '#get_function-instance_method': '/documentation/modules/meta#get-function', + '#global_variable_exists-instance_method': + '/documentation/modules/meta#global-variable-exists', + '#grayscale-instance_method': '/documentation/modules/color#grayscale', + '#green-instance_method': '/documentation/modules/color#green', + '#hsl-instance_method': '/documentation/modules/color#hsl', + '#hsla-instance_method': '/documentation/modules/color#hsla', + '#hue-instance_method': '/documentation/modules/color#hue', + '#ie_hex_str-instance_method': '/documentation/modules/color#ie-hex-str', + '#if-instance_method': '/documentation/#if', + '#index-instance_method': '/documentation/modules/list#index', + '#inspect-instance_method': '/documentation/modules/meta#inspect', + '#invert-instance_method': '/documentation/modules/color#invert', + '#is_bracketed-instance_method': '/documentation/modules/list#is-bracketed', + '#is_superselector-instance_method': + '/documentation/modules/selector#is-superselector', + '#join-instance_method': '/documentation/modules/list#join', + '#keywords-instance_method': '/documentation/modules/meta#keywords', + '#length-instance_method': '/documentation/modules/list#length', + '#lighten-instance_method': '/documentation/modules/color#lighten', + '#lightness-instance_method': '/documentation/modules/color#lightness', + '#list_separator-instance_method': '/documentation/modules/list#separator', + '#map_get-instance_method': '/documentation/modules/map#get', + '#map_has_key-instance_method': '/documentation/modules/map#has-key', + '#map_keys-instance_method': '/documentation/modules/map#keys', + '#map_merge-instance_method': '/documentation/modules/map#merge', + '#map_remove-instance_method': '/documentation/modules/map#remove', + '#map_values-instance_method': '/documentation/modules/map#values', + '#max-instance_method': '/documentation/modules/math#max', + '#min-instance_method': '/documentation/modules/math#min', + '#mix-instance_method': '/documentation/modules/color#mix', + '#mixin_exists-instance_method': '/documentation/modules/meta#mixin-exists', + '#nth-instance_method': '/documentation/modules/list#nth', + '#opacify-instance_method': '/documentation/modules/color#opacify', + '#opacity-instance_method': '/documentation/modules/color#opacity', + '#percentage-instance_method': '/documentation/modules/math#percentage', + '#quote-instance_method': '/documentation/modules/string#quote', + '#random-instance_method': '/documentation/modules/math#random', + '#red-instance_method': '/documentation/modules/color#red', + '#rgb-instance_method': '/documentation/modules/color#rgb', + '#rgba-instance_method': '/documentation/modules/color#rgba', + '#round-instance_method': '/documentation/modules/math#round', + '#saturate-instance_method': '/documentation/modules/color#saturate', + '#saturation-instance_method': '/documentation/modules/color#saturation', + '#scale_color-instance_method': '/documentation/modules/color#scale', + '#selector_append-instance_method': + '/documentation/modules/selector#append', + '#selector_extend-instance_method': + '/documentation/modules/selector#extend', + '#selector_nest-instance_method': '/documentation/modules/selector#nest', + '#selector_parse-instance_method': '/documentation/modules/selector#parse', + '#selector_replace-instance_method': + '/documentation/modules/selector#replace', + '#selector_unify-instance_method': '/documentation/modules/selector#unify', + '#set-instance_method': '/documentation/modules/list#set', + '#simple_selectors-instance_method': + '/documentation/modules/selector#simple-selectors', + '#str_index-instance_method': '/documentation/modules/string#index', + '#str_insert-instance_method': '/documentation/modules/string#insert', + '#str_length-instance_method': '/documentation/modules/string#length', + '#str_slice-instance_method': '/documentation/modules/string#slice', + '#to_lower_case-instance_method': + '/documentation/modules/string#to-lower-case', + '#to_upper_case-instance_method': + '/documentation/modules/string#to-upper-case', + '#transparentize-instance_method': + '/documentation/modules/color#transparentize', + '#type_of-instance_method': '/documentation/modules/meta#type-of', + '#unique_id-instance_method': '/documentation/modules/string#unique-id', + '#unit-instance_method': '/documentation/modules/math#unit', + '#unitless-instance_method': '/documentation/modules/math#is-unitless', + '#unquote-instance_method': '/documentation/modules/string#unquote', + '#variable_exists-instance_method': + '/documentation/modules/meta#variable-exists', + '#zip-instance_method': '/documentation/modules/list#zip', + }, + '/documentation/modules/color/': { + '#rgb': '/documentation/modules#rgb', + '#rgba': '/documentation/modules#rgba', + '#hsl': '/documentation/modules#hsl', + '#hsla': '/documentation/modules#hsla', + }, + '/documentation/modules/map/': { + '#keywords': '/documentation/modules/meta#keywords', + }, + '/documentation/at-rules/use/': { + '#configuring-modules': '/documentation/at-rules/use#configuration', + }, + '/documentation/syntax/special-functions/': { + '#calc-clamp-element-progid-and-expression': + '/documentation/syntax/special-functions#element-progid-and-expression', + '#min-and-max': '/documentation/values/calculations#min-and-max', + }, + '/documentation/js-api/': { + '#rendersync': '/documentation/js-api/functions/rendersync/', + '#render': '/documentation/js-api/functions/render/', + '#info': '/documentation/js-api/variables/info/', + '#result-css': '/documentation/js-api/interfaces/LegacyResult#css', + '#result-map': '/documentation/js-api/interfaces/LegacyResult#map', + '#result-stats-includedfiles': + '/documentation/js-api/interfaces/LegacyResult#stats', + '#result-stats-entry': + '/documentation/js-api/interfaces/LegacyResult#stats', + '#result-stats-start': + '/documentation/js-api/interfaces/LegacyResult#stats', + '#result-stats-end': '/documentation/js-api/interfaces/LegacyResult#stats', + '#result-stats-duration': + '/documentation/js-api/interfaces/LegacyResult#stats', + '#error-object': '/documentation/js-api/interfaces/LegacyException', + '#error-formatted': + '/documentation/js-api/interfaces/LegacyException#formatted', + '#error-file': '/documentation/js-api/interfaces/LegacyException#file', + '#error-line': '/documentation/js-api/interfaces/LegacyException#line', + '#error-column': '/documentation/js-api/interfaces/LegacyException#column', + '#error-status': '/documentation/js-api/interfaces/LegacyException#status', + '#options': '/documentation/js-api/interfaces/LegacySharedOptions', + '#input': '/documentation/js-api/interfaces/LegacyFileOptions#includepaths', + '#file': '/documentation/js-api/interfaces/LegacyFileOptions#file', + '#data': '/documentation/js-api/interfaces/LegacyStringOptions#data', + '#indentedsyntax': + '/documentation/js-api/interfaces/LegacyStringOptions#indentedSyntax', + '#includepaths': + '/documentation/js-api/interfaces/LegacySharedOptions#includePaths', + '#output': '/documentation/js-api/interfaces/LegacySharedOptions#charset', + '#outputstyle': + '/documentation/js-api/interfaces/LegacySharedOptions#outputStyle', + '#charset': '/documentation/js-api/interfaces/LegacySharedOptions#charset', + '#precision': + '/documentation/js-api/interfaces/LegacySharedOptions#precision', + '#indentType': + '/documentation/js-api/interfaces/LegacySharedOptions#indentType', + '#indentWidth': + '/documentation/js-api/interfaces/LegacySharedOptions#indentWidth', + '#linefeed': + '/documentation/js-api/interfaces/LegacySharedOptions#linefeed', + '#sourceComments': + '/documentation/js-api/interfaces/LegacySharedOptions#sourceComments', + '#source-maps': + '/documentation/js-api/interfaces/LegacySharedOptions#sourceMap', + '#sourcemap': + '/documentation/js-api/interfaces/LegacySharedOptions#sourceMap', + '#outfile': '/documentation/js-api/interfaces/LegacySharedOptions#outFile', + '#omitsourcemapurl': + '/documentation/js-api/interfaces/LegacySharedOptions#omitSourceMapUrl', + '#sourcemapcontents': + '/documentation/js-api/interfaces/LegacySharedOptions#sourceMapContents', + '#sourcemapembed': + '/documentation/js-api/interfaces/LegacySharedOptions#sourceMapEmbed', + '#sourcemaproot': + '/documentation/js-api/interfaces/LegacySharedOptions#sourceMapRoot', + '#plugins': '/documentation/js-api/interfaces/LegacySharedOptions', + '#fiber': '/blog/node-fibers-discontinued', + '#functions': + '/documentation/js-api/interfaces/LegacySharedOptions#functions', + '#importer': + '/documentation/js-api/interfaces/LegacySharedOptions#importer', + '#other': '/documentation/js-api/interfaces/LegacySharedOptions', + '#quietdeps': + '/documentation/js-api/interfaces/LegacySharedOptions#quietDeps', + '#verbose': '/documentation/js-api/interfaces/LegacySharedOptions#verbose', + '#value-types': '/documentation/js-api/modules/types', + '#types-number': '/documentation/js-api/classes/types.Number', + '#new-types-number-value-unit': + '/documentation/js-api/classes/types.Number#constructor', + '#number-getvalue': '/documentation/js-api/classes/types.Number#getValue', + '#number-getunit': '/documentation/js-api/classes/types.Number#getUnit', + '#number-setvalue-value': + '/documentation/js-api/classes/types.Number#setValue', + '#number-setunit-unit': + '/documentation/js-api/classes/types.Number#setUnit', + '#types-string': '/documentation/js-api/classes/types.String', + '#new-types-string-value': + '/documentation/js-api/classes/types.String#constructor', + '#string-getvalue': '/documentation/js-api/classes/types.String#getValue', + '#string-setvalue-value': + '/documentation/js-api/classes/types.String#setValue', + '#types-color': '/documentation/js-api/classes/types.Color', + '#new-types-color-red-green-blue-alpha-1': + '/documentation/js-api/classes/types.Color#constructor', + '#new-types-argb': '/documentation/js-api/classes/types.Color#constructor', + '#color-getr': '/documentation/js-api/classes/types.Color#getR', + '#color-getg': '/documentation/js-api/classes/types.Color#getG', + '#color-getb': '/documentation/js-api/classes/types.Color#getB', + '#color-geta': '/documentation/js-api/classes/types.Color#getA', + '#color-setr-red': '/documentation/js-api/classes/types.Color#setR', + '#color-setg-green': '/documentation/js-api/classes/types.Color#setG', + '#color-setb-blue': '/documentation/js-api/classes/types.Color#setB', + '#color-seta-alpha': '/documentation/js-api/classes/types.Color#setA', + '#types-boolean': '/documentation/js-api/classes/types.Boolean', + '#types-boolean-true': '/documentation/js-api/classes/types.Boolean#TRUE', + '#types-boolean-false': '/documentation/js-api/classes/types.Boolean#FALSE', + '#types-boolean-getvalue': + '/documentation/js-api/classes/types.Boolean#getValue', + '#types-list': '/documentation/js-api/classes/types.List', + '#new-types-list-length-comma-true': + '/documentation/js-api/classes/types.List#constructor', + '#list-getvalue-index': '/documentation/js-api/classes/types.List#getValue', + '#list-getseparator': + '/documentation/js-api/classes/types.List#getSeparator', + '#list-getlength': '/documentation/js-api/classes/types.List#getLength', + '#list-setvalue-index-value': + '/documentation/js-api/classes/types.List#setValue', + '#list-setseparator-comma': + '/documentation/js-api/classes/types.List#setSeparator', + '#types-map': '/documentation/js-api/classes/types.Map', + '#new-types-map-length': + '/documentation/js-api/classes/types.Map#constructor', + '#map-getkey-index': '/documentation/js-api/classes/types.Map#getKey', + '#map-getvalue-index': '/documentation/js-api/classes/types.Map#getValue', + '#map-getlength': '/documentation/js-api/classes/types.Map#getLength', + '#map-setkey-index-key': '/documentation/js-api/classes/types.Map#setKey', + '#map-setvalue-index-value': + '/documentation/js-api/classes/types.Map#setValue', + '#types-null': '/documentation/js-api/classes/types.Null', + '#types-null-null': '/documentation/js-api/classes/types.Null#NULL', + }, +}; - let redirect: string | undefined = redirects[window.location.hash]; - - // If the user is looking for a Ruby Sass option, redirect them to the Ruby - // Sass page for an explanation that it's deprecated. - if (!redirect && window.location.hash.match(/-option$/)) { - redirect = '/ruby-sass'; - } - - if (redirect) { - window.location.href = redirect; - } - } else if (window.location.pathname == '/documentation/modules') { - const redirects: Record = { - '#declare-class_method': '/ruby-sass', - '#random_number_generator-class_method': '/ruby-sass', - '#random_seed=-class_method': '/ruby-sass', - '#signature-class_method': '/ruby-sass', - '#abs-instance_method': '/documentation/modules/math#abs', - '#adjust_color-instance_method': '/documentation/modules/color#adjust', - '#adjust_hue-instance_method': '/documentation/modules/color#adjust-hue', - '#alpha-instance_method': '/documentation/modules/color#alpha', - '#append-instance_method': '/documentation/modules/list#append', - '#blue-instance_method': '/documentation/modules/color#blue', - '#call-instance_method': '/documentation/modules/meta#call', - '#ceil-instance_method': '/documentation/modules/math#ceil', - '#change_color-instance_method': '/documentation/modules/color#change', - '#comparable-instance_method': '/documentation/modules/math#compatible', - '#complement-instance_method': '/documentation/modules/color#complement', - '#content_exists-instance_method': - '/documentation/modules/meta#content-exists', - '#darken-instance_method': '/documentation/modules/color#darken', - '#desaturate-instance_method': '/documentation/modules/color#desaturate', - '#feature_exists-instance_method': - '/documentation/modules/meta#feature-exists', - '#floor-instance_method': '/documentation/modules/math#floor', - '#get_function-instance_method': - '/documentation/modules/meta#get-function', - '#global_variable_exists-instance_method': - '/documentation/modules/meta#global-variable-exists', - '#grayscale-instance_method': '/documentation/modules/color#grayscale', - '#green-instance_method': '/documentation/modules/color#green', - '#hsl-instance_method': '/documentation/modules/color#hsl', - '#hsla-instance_method': '/documentation/modules/color#hsla', - '#hue-instance_method': '/documentation/modules/color#hue', - '#ie_hex_str-instance_method': '/documentation/modules/color#ie-hex-str', - '#if-instance_method': '/documentation/#if', - '#index-instance_method': '/documentation/modules/list#index', - '#inspect-instance_method': '/documentation/modules/meta#inspect', - '#invert-instance_method': '/documentation/modules/color#invert', - '#is_bracketed-instance_method': - '/documentation/modules/list#is-bracketed', - '#is_superselector-instance_method': - '/documentation/modules/selector#is-superselector', - '#join-instance_method': '/documentation/modules/list#join', - '#keywords-instance_method': '/documentation/modules/meta#keywords', - '#length-instance_method': '/documentation/modules/list#length', - '#lighten-instance_method': '/documentation/modules/color#lighten', - '#lightness-instance_method': '/documentation/modules/color#lightness', - '#list_separator-instance_method': - '/documentation/modules/list#separator', - '#map_get-instance_method': '/documentation/modules/map#get', - '#map_has_key-instance_method': '/documentation/modules/map#has-key', - '#map_keys-instance_method': '/documentation/modules/map#keys', - '#map_merge-instance_method': '/documentation/modules/map#merge', - '#map_remove-instance_method': '/documentation/modules/map#remove', - '#map_values-instance_method': '/documentation/modules/map#values', - '#max-instance_method': '/documentation/modules/math#max', - '#min-instance_method': '/documentation/modules/math#min', - '#mix-instance_method': '/documentation/modules/color#mix', - '#mixin_exists-instance_method': - '/documentation/modules/meta#mixin-exists', - '#nth-instance_method': '/documentation/modules/list#nth', - '#opacify-instance_method': '/documentation/modules/color#opacify', - '#opacity-instance_method': '/documentation/modules/color#opacity', - '#percentage-instance_method': '/documentation/modules/math#percentage', - '#quote-instance_method': '/documentation/modules/string#quote', - '#random-instance_method': '/documentation/modules/math#random', - '#red-instance_method': '/documentation/modules/color#red', - '#rgb-instance_method': '/documentation/modules/color#rgb', - '#rgba-instance_method': '/documentation/modules/color#rgba', - '#round-instance_method': '/documentation/modules/math#round', - '#saturate-instance_method': '/documentation/modules/color#saturate', - '#saturation-instance_method': '/documentation/modules/color#saturation', - '#scale_color-instance_method': '/documentation/modules/color#scale', - '#selector_append-instance_method': - '/documentation/modules/selector#append', - '#selector_extend-instance_method': - '/documentation/modules/selector#extend', - '#selector_nest-instance_method': '/documentation/modules/selector#nest', - '#selector_parse-instance_method': - '/documentation/modules/selector#parse', - '#selector_replace-instance_method': - '/documentation/modules/selector#replace', - '#selector_unify-instance_method': - '/documentation/modules/selector#unify', - '#set-instance_method': '/documentation/modules/list#set', - '#simple_selectors-instance_method': - '/documentation/modules/selector#simple-selectors', - '#str_index-instance_method': '/documentation/modules/string#index', - '#str_insert-instance_method': '/documentation/modules/string#insert', - '#str_length-instance_method': '/documentation/modules/string#length', - '#str_slice-instance_method': '/documentation/modules/string#slice', - '#to_lower_case-instance_method': - '/documentation/modules/string#to-lower-case', - '#to_upper_case-instance_method': - '/documentation/modules/string#to-upper-case', - '#transparentize-instance_method': - '/documentation/modules/color#transparentize', - '#type_of-instance_method': '/documentation/modules/meta#type-of', - '#unique_id-instance_method': '/documentation/modules/string#unique-id', - '#unit-instance_method': '/documentation/modules/math#unit', - '#unitless-instance_method': '/documentation/modules/math#is-unitless', - '#unquote-instance_method': '/documentation/modules/string#unquote', - '#variable_exists-instance_method': - '/documentation/modules/meta#variable-exists', - '#zip-instance_method': '/documentation/modules/list#zip', - }; - - const redirect: string | undefined = redirects[window.location.hash]; - if (redirect) { - window.location.href = redirect; - } - } else if (window.location.pathname == '/documentation/modules/color') { - const redirects: Record = { - '#rgb': '/documentation/modules#rgb', - '#rgba': '/documentation/modules#rgba', - '#hsl': '/documentation/modules#hsl', - '#hsla': '/documentation/modules#hsla', - }; - - const redirect: string | undefined = redirects[window.location.hash]; - if (redirect) { - window.location.href = redirect; - } - } else if (window.location.pathname == '/documentation/modules/map') { - const redirects: Record = { - '#keywords': '/documentation/modules/meta#keywords', - }; - - const redirect: string | undefined = redirects[window.location.hash]; - if (redirect) { - window.location.href = redirect; - } - } else if (window.location.pathname == '/documentation/at-rules/use') { - const redirects: Record = { - '#configuring-modules': '/documentation/at-rules/use#configuration', - }; - - const redirect: string | undefined = redirects[window.location.hash]; - if (redirect) { - window.location.href = redirect; - } - } else if ( - window.location.pathname == '/documentation/syntax/special-functions' - ) { - const redirects: Record = { - '#calc-clamp-element-progid-and-expression': - '/documentation/syntax/special-functions#element-progid-and-expression', - '#min-and-max': '/documentation/values/calculations#min-and-max', - }; - - const redirect: string | undefined = redirects[window.location.hash]; - if (redirect) { - window.location.href = redirect; - } - } else if (window.location.pathname == '/documentation/js-api') { - const redirects: Record = { - '#rendersync': '/documentation/js-api/modules#renderSync', - '#render': '/documentation/js-api/modules#render', - '#info': '/documentation/js-api/modules#info', - '#result-css': '/documentation/js-api/interfaces/LegacyResult#css', - '#result-map': '/documentation/js-api/interfaces/LegacyResult#map', - '#result-stats-includedfiles': - '/documentation/js-api/interfaces/LegacyResult#stats', - '#result-stats-entry': - '/documentation/js-api/interfaces/LegacyResult#stats', - '#result-stats-start': - '/documentation/js-api/interfaces/LegacyResult#stats', - '#result-stats-end': - '/documentation/js-api/interfaces/LegacyResult#stats', - '#result-stats-duration': - '/documentation/js-api/interfaces/LegacyResult#stats', - '#error-object': '/documentation/js-api/interfaces/LegacyException', - '#error-formatted': - '/documentation/js-api/interfaces/LegacyException#formatted', - '#error-file': '/documentation/js-api/interfaces/LegacyException#file', - '#error-line': '/documentation/js-api/interfaces/LegacyException#line', - '#error-column': - '/documentation/js-api/interfaces/LegacyException#column', - '#error-status': - '/documentation/js-api/interfaces/LegacyException#status', - '#options': '/documentation/js-api/interfaces/LegacySharedOptions', - '#input': - '/documentation/js-api/interfaces/LegacyFileOptions#includepaths', - '#file': '/documentation/js-api/interfaces/LegacyFileOptions#file', - '#data': '/documentation/js-api/interfaces/LegacyStringOptions#data', - '#indentedsyntax': - '/documentation/js-api/interfaces/LegacyStringOptions#indentedSyntax', - '#includepaths': - '/documentation/js-api/interfaces/LegacySharedOptions#includePaths', - '#output': '/documentation/js-api/interfaces/LegacySharedOptions#charset', - '#outputstyle': - '/documentation/js-api/interfaces/LegacySharedOptions#outputStyle', - '#charset': - '/documentation/js-api/interfaces/LegacySharedOptions#charset', - '#precision': - '/documentation/js-api/interfaces/LegacySharedOptions#precision', - '#indentType': - '/documentation/js-api/interfaces/LegacySharedOptions#indentType', - '#indentWidth': - '/documentation/js-api/interfaces/LegacySharedOptions#indentWidth', - '#linefeed': - '/documentation/js-api/interfaces/LegacySharedOptions#linefeed', - '#sourceComments': - '/documentation/js-api/interfaces/LegacySharedOptions#sourceComments', - '#source-maps': - '/documentation/js-api/interfaces/LegacySharedOptions#sourceMap', - '#sourcemap': - '/documentation/js-api/interfaces/LegacySharedOptions#sourceMap', - '#outfile': - '/documentation/js-api/interfaces/LegacySharedOptions#outFile', - '#omitsourcemapurl': - '/documentation/js-api/interfaces/LegacySharedOptions#omitSourceMapUrl', - '#sourcemapcontents': - '/documentation/js-api/interfaces/LegacySharedOptions#sourceMapContents', - '#sourcemapembed': - '/documentation/js-api/interfaces/LegacySharedOptions#sourceMapEmbed', - '#sourcemaproot': - '/documentation/js-api/interfaces/LegacySharedOptions#sourceMapRoot', - '#plugins': '/documentation/js-api/interfaces/LegacySharedOptions', - '#fiber': '/blog/node-fibers-discontinued', - '#functions': - '/documentation/js-api/interfaces/LegacySharedOptions#functions', - '#importer': - '/documentation/js-api/interfaces/LegacySharedOptions#importer', - '#other': '/documentation/js-api/interfaces/LegacySharedOptions', - '#quietdeps': - '/documentation/js-api/interfaces/LegacySharedOptions#quietDeps', - '#verbose': - '/documentation/js-api/interfaces/LegacySharedOptions#verbose', - '#value-types': '/documentation/js-api/modules/types', - '#types-number': '/documentation/js-api/classes/types.Number', - '#new-types-number-value-unit': - '/documentation/js-api/classes/types.Number#constructor', - '#number-getvalue': '/documentation/js-api/classes/types.Number#getValue', - '#number-getunit': '/documentation/js-api/classes/types.Number#getUnit', - '#number-setvalue-value': - '/documentation/js-api/classes/types.Number#setValue', - '#number-setunit-unit': - '/documentation/js-api/classes/types.Number#setUnit', - '#types-string': '/documentation/js-api/classes/types.String', - '#new-types-string-value': - '/documentation/js-api/classes/types.String#constructor', - '#string-getvalue': '/documentation/js-api/classes/types.String#getValue', - '#string-setvalue-value': - '/documentation/js-api/classes/types.String#setValue', - '#types-color': '/documentation/js-api/classes/types.Color', - '#new-types-color-red-green-blue-alpha-1': - '/documentation/js-api/classes/types.Color#constructor', - '#new-types-argb': - '/documentation/js-api/classes/types.Color#constructor', - '#color-getr': '/documentation/js-api/classes/types.Color#getR', - '#color-getg': '/documentation/js-api/classes/types.Color#getG', - '#color-getb': '/documentation/js-api/classes/types.Color#getB', - '#color-geta': '/documentation/js-api/classes/types.Color#getA', - '#color-setr-red': '/documentation/js-api/classes/types.Color#setR', - '#color-setg-green': '/documentation/js-api/classes/types.Color#setG', - '#color-setb-blue': '/documentation/js-api/classes/types.Color#setB', - '#color-seta-alpha': '/documentation/js-api/classes/types.Color#setA', - '#types-boolean': '/documentation/js-api/classes/types.Boolean', - '#types-boolean-true': '/documentation/js-api/classes/types.Boolean#TRUE', - '#types-boolean-false': - '/documentation/js-api/classes/types.Boolean#FALSE', - '#types-boolean-getvalue': - '/documentation/js-api/classes/types.Boolean#getValue', - '#types-list': '/documentation/js-api/classes/types.List', - '#new-types-list-length-comma-true': - '/documentation/js-api/classes/types.List#constructor', - '#list-getvalue-index': - '/documentation/js-api/classes/types.List#getValue', - '#list-getseparator': - '/documentation/js-api/classes/types.List#getSeparator', - '#list-getlength': '/documentation/js-api/classes/types.List#getLength', - '#list-setvalue-index-value': - '/documentation/js-api/classes/types.List#setValue', - '#list-setseparator-comma': - '/documentation/js-api/classes/types.List#setSeparator', - '#types-map': '/documentation/js-api/classes/types.Map', - '#new-types-map-length': - '/documentation/js-api/classes/types.Map#constructor', - '#map-getkey-index': '/documentation/js-api/classes/types.Map#getKey', - '#map-getvalue-index': '/documentation/js-api/classes/types.Map#getValue', - '#map-getlength': '/documentation/js-api/classes/types.Map#getLength', - '#map-setkey-index-key': '/documentation/js-api/classes/types.Map#setKey', - '#map-setvalue-index-value': - '/documentation/js-api/classes/types.Map#setValue', - '#types-null': '/documentation/js-api/classes/types.Null', - '#types-null-null': '/documentation/js-api/classes/types.Null#NULL', - }; - - const redirect: string | undefined = redirects[window.location.hash]; - if (redirect) { - window.location.href = redirect; - } - } +const { pathname, hash } = window.location; +const match = redirects[pathname]?.[hash]; +if (match) { + window.location.href = match; +} else if (pathname === '/documentation/' && hash.match(/-option$/)) { + // If the user is looking for a Ruby Sass option, redirect them to the Ruby + // Sass page for an explanation that it's deprecated. + window.location.href = '/ruby-sass'; }