Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(documentation): add base search url #2799

Merged
merged 7 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions projects/documentation/.eleventy.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,26 @@ module.exports = function (eleventyConfig) {
},
});

eleventyConfig.addTransform("transform-postHTML", async function(content, outputPath) {
const posthtml = await import('posthtml').then(module => module.default);
const spectrumMarkdown = await import('./src/utils/posthtml-spectrum-docs-markdown.js').then(module => module.default);
if( outputPath && outputPath.endsWith(".html") ) {
return posthtml()
.use(spectrumMarkdown())
.process(content, { sync: true })
.html
eleventyConfig.addTransform(
'transform-postHTML',
async function (content, outputPath) {
const posthtml = await import('posthtml').then(
(module) => module.default
);
const spectrumMarkdown = await import(
'./src/utils/posthtml-spectrum-docs-markdown.js'
).then((module) => module.default);
if (outputPath && outputPath.endsWith('.html')) {
return posthtml()
.use(spectrumMarkdown())
.process(content, { sync: true }).html;
}
return content; // no change done.
}
return content; // no change done.
});

eleventyConfig.setLibrary(
'md',
markdown
);

eleventyConfig.setLibrary('md', markdown);

eleventyConfig.addCollection('guides', (collection) => {
return [...collection.getFilteredByGlob('./content/guides/*.md')];
});
Expand Down
25 changes: 22 additions & 3 deletions projects/documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"build:postcss": "wireit",
"build:production": "wireit",
"build:search-index": "wireit",
"build:search-index:prod": "wireit",
"build:tsc": "wireit",
"copy-docs": "wireit",
"serve": "wireit",
Expand Down Expand Up @@ -72,6 +73,9 @@
"dependencies": [
{
"script": "build:assets"
},
{
"script": "build:search-index"
}
]
},
Expand All @@ -85,9 +89,6 @@
},
{
"script": "build:postcss"
},
{
"script": "build:search-index"
}
]
},
Expand Down Expand Up @@ -138,11 +139,25 @@
"dependencies": [
{
"script": "build:assets"
},
{
"script": "build:search-index:prod"
}
]
},
"build:search-index": {
"command": "node scripts/build-search-index.js",
"files": [
"../../packages/*/*.md",
"../../tools/*/*.md",
"./**/scripts/build-search-index.js"
],
"output": [
"dist/searchIndex.json"
]
},
"build:search-index:prod": {
"command": "SWC_DIR=spectrum-web-components node scripts/build-search-index.js",
"files": [
"../../packages/*/*.md",
"../../tools/*/*.md",
Expand Down Expand Up @@ -196,6 +211,10 @@
{
"script": "build:assets",
"cascade": false
},
{
"script": "build:search-index",
"cascade": false
}
]
}
Expand Down
2 changes: 0 additions & 2 deletions projects/documentation/scripts/build-ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ governing permissions and limitations under the License.
import { build } from 'esbuild';
import { litCssPlugin } from 'esbuild-plugin-lit-css';
import postcss from 'postcss';
// import { postCSSPlugins } from '../../../scripts/css-processing.cjs';
import purgecss from '@fullhuman/postcss-purgecss';
Copy link
Contributor Author

@nickschaap nickschaap Dec 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed unused import

import postcssImport from 'postcss-import';
import postcssEnv from 'postcss-preset-env';
import cssnano from 'cssnano';
Expand Down
4 changes: 2 additions & 2 deletions projects/documentation/src/components/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ body {
width: 36px;
height: 31px;
display: block;
margin-right: var(--spectrum-global-dimension-size-200);
Copy link
Contributor Author

@nickschaap nickschaap Dec 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used logical operators for RTL margins of the sidenav header

margin-inline-end: var(--spectrum-spacing-300);
margin-bottom: 12px;
flex-shrink: 0;
position: relative;
Expand Down Expand Up @@ -737,4 +737,4 @@ icons-demo::part(search) {
icons-demo::part(icon) {
padding: calc(0.5 * var(--spectrum-global-dimension-static-size-200)) 0;
gap: var(--spectrum-global-dimension-static-size-200);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/

import postHTMLSpectrumTypeography from './posthtml-spectrum-typography.js';
export { postHTMLSpectrumTypeography };
Copy link
Contributor Author

@nickschaap nickschaap Dec 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed typo

import postHTMLSpectrumTypography from './posthtml-spectrum-typography.js';
export { postHTMLSpectrumTypography };

// Add a few doc-specific transforms for code examples

export default () =>
postHTMLSpectrumTypeography({
postHTMLSpectrumTypography({
customTransforms: [
{
// take `<pre>` tags where their first child is a `<code>` tag,
Expand Down