How to use the gatsby-link.withPrefix function in gatsby-link

To help you get started, we’ve selected a few gatsby-link examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rodrigopivi / aida / typescript / web / components / TrainExample.tsx View on Github external
private trainTestAndSaveModels = async () => {
        const files = [
            withPrefix('/models/dictionary.json'),
            withPrefix('/models/ngram_to_id_dictionary.json'),
            withPrefix('/models/dataset_params.json'),
            withPrefix('/models/dataset_training.json'),
            withPrefix('/models/dataset_testing.json')
        ];
        const jsonFiles = await this.downloadFiles(files);
        const pretrainedNGramVectors = new Map(jsonFiles[0].data);
        const ngramToIdDictionary = jsonFiles[1].data;
        const datasetParams = jsonFiles[2].data;
        const datasetTraining = jsonFiles[3].data;
        const datasetTest = jsonFiles[4].data;
        await this.timeoutInMs(200); // give some time for the state update after the model setup (before the gpu blocks)
        this.setState({
            datasetParams,
            datasetTest,
            datasetTraining,
            embeddingsAndTrainingDatasetLoaded: true,
            ngramToIdDictionary,
            pretrainedNGramVectors
        });
github rodrigopivi / aida / typescript / web / components / TrainExample.tsx View on Github external
private trainTestAndSaveModels = async () => {
        const files = [
            withPrefix('/models/dictionary.json'),
            withPrefix('/models/ngram_to_id_dictionary.json'),
            withPrefix('/models/dataset_params.json'),
            withPrefix('/models/dataset_training.json'),
            withPrefix('/models/dataset_testing.json')
        ];
        const jsonFiles = await this.downloadFiles(files);
        const pretrainedNGramVectors = new Map(jsonFiles[0].data);
        const ngramToIdDictionary = jsonFiles[1].data;
        const datasetParams = jsonFiles[2].data;
        const datasetTraining = jsonFiles[3].data;
        const datasetTest = jsonFiles[4].data;
        await this.timeoutInMs(200); // give some time for the state update after the model setup (before the gpu blocks)
        this.setState({
            datasetParams,
            datasetTest,
            datasetTraining,
            embeddingsAndTrainingDatasetLoaded: true,
            ngramToIdDictionary,
            pretrainedNGramVectors
github patternfly / patternfly-react / packages / patternfly-4 / react-docs / src / layouts / example.js View on Github external
import PropTypes from 'prop-types';
import { withPrefix } from 'gatsby-link';

// This is a gatsby limitation will be fixed in newer version
let globalStyles = require(`!raw-loader!@patternfly/react-core/../dist/styles/base.css`);
globalStyles = globalStyles.replace(/\.\/assets\//g, withPrefix('/assets/'));
const localStyles = require(`!raw-loader!./index.css`);
import { injectGlobal } from 'emotion';

injectGlobal(globalStyles);
injectGlobal(localStyles);

const propTypes = {
  children: PropTypes.func.isRequired
};

const Layout = ({ children }) => children();

Layout.propTypes = propTypes;

export default Layout;
github caki0915 / gatsby-starter-redux / src / components / Drawer / index.js View on Github external
onClick={() => {
          navigateTo(withPrefix(item.url));
          toggleDrawer(false);
        }}
      >
github Financial-Times / x-dash / tools / x-docs / src / templates / story.js View on Github external
const formatStorybookUrl = ({componentName, componentStory}) => withPrefix(
	url.format({
		pathname: '/storybook/index.html',
		query: {
			selectedKind: componentName,
			selectedStory: componentStory,
		},
	})
);
github vibertthio / portfolio / src / layouts / collapse.js View on Github external
const ListLinkOut = props => (
  <a> props.onClick()}
    href={props.to}
    rel="noopener noreferrer"
    target="_blank"
  &gt;
    <p>{props.children}</p>
  </a>
);
github rodrigopivi / aida / typescript / web / components / LoadPreTrainedExample.tsx View on Github external
private downloadsTrainedModel = async (backend: 'web' | 'node' | 'keras') => {
        const modelsUrls = {
            keras: {
                classification: withPrefix('/models/pretrained/keras/classification/model.json'),
                embedding: withPrefix('/models/pretrained/keras/embedding/model.json'),
                ner: withPrefix('/models/pretrained/keras/ner/model.json')
            },
            node: {
                classification: withPrefix('/models/pretrained/node/classification/model.json'),
                embedding: withPrefix('/models/pretrained/node/embedding/model.json'),
                ner: withPrefix('/models/pretrained/node/ner/model.json')
            },
            web: {
                classification: withPrefix('/models/pretrained/web/classification/classification.json'),
                embedding: withPrefix('/models/pretrained/web/embedding/embedding.json'),
                ner: withPrefix('/models/pretrained/web/ner/ner.json')
            }
        };
        const pretrainedEmbedding = await tf.loadLayersModel(modelsUrls[backend].embedding, { strict: false });
        const pretrainedClassifier = await tf.loadLayersModel(modelsUrls[backend].classification);
        const pretrainedNer = await tf.loadLayersModel(modelsUrls[backend].ner);
        return { pretrainedEmbedding, pretrainedClassifier, pretrainedNer };
    };
github rodrigopivi / aida / typescript / web / components / LoadPreTrainedExample.tsx View on Github external
private downloadsTrainedModel = async (backend: 'web' | 'node' | 'keras') => {
        const modelsUrls = {
            keras: {
                classification: withPrefix('/models/pretrained/keras/classification/model.json'),
                embedding: withPrefix('/models/pretrained/keras/embedding/model.json'),
                ner: withPrefix('/models/pretrained/keras/ner/model.json')
            },
            node: {
                classification: withPrefix('/models/pretrained/node/classification/model.json'),
                embedding: withPrefix('/models/pretrained/node/embedding/model.json'),
                ner: withPrefix('/models/pretrained/node/ner/model.json')
            },
            web: {
                classification: withPrefix('/models/pretrained/web/classification/classification.json'),
                embedding: withPrefix('/models/pretrained/web/embedding/embedding.json'),
                ner: withPrefix('/models/pretrained/web/ner/ner.json')
            }
        };
        const pretrainedEmbedding = await tf.loadLayersModel(modelsUrls[backend].embedding, { strict: false });
        const pretrainedClassifier = await tf.loadLayersModel(modelsUrls[backend].classification);
        const pretrainedNer = await tf.loadLayersModel(modelsUrls[backend].ner);
        return { pretrainedEmbedding, pretrainedClassifier, pretrainedNer };
    };
github vibertthio / portfolio / src / layouts / nav-list.js View on Github external
const ListLinkOut = props =&gt; (
  <li style="{{">
    <a href="{props.to}" rel="noopener noreferrer">
      {props.children}
    </a>
  </li>
);
github rodrigopivi / aida / typescript / web / components / LoadPreTrainedExample.tsx View on Github external
private downloadsTrainedModel = async (backend: 'web' | 'node' | 'keras') => {
        const modelsUrls = {
            keras: {
                classification: withPrefix('/models/pretrained/keras/classification/model.json'),
                embedding: withPrefix('/models/pretrained/keras/embedding/model.json'),
                ner: withPrefix('/models/pretrained/keras/ner/model.json')
            },
            node: {
                classification: withPrefix('/models/pretrained/node/classification/model.json'),
                embedding: withPrefix('/models/pretrained/node/embedding/model.json'),
                ner: withPrefix('/models/pretrained/node/ner/model.json')
            },
            web: {
                classification: withPrefix('/models/pretrained/web/classification/classification.json'),
                embedding: withPrefix('/models/pretrained/web/embedding/embedding.json'),
                ner: withPrefix('/models/pretrained/web/ner/ner.json')
            }
        };
        const pretrainedEmbedding = await tf.loadLayersModel(modelsUrls[backend].embedding, { strict: false });
        const pretrainedClassifier = await tf.loadLayersModel(modelsUrls[backend].classification);
        const pretrainedNer = await tf.loadLayersModel(modelsUrls[backend].ner);

gatsby-link

An enhanced Link component for Gatsby sites with support for resource prefetching

MIT
Latest version published 2 days ago

Package Health Score

92 / 100
Full package analysis