3.2.0 • Published 1 year ago

@prefresh/snowpack v3.2.0

Weekly downloads
1,587
License
MIT
Repository
github
Last release
1 year ago

Prefresh-snowpack

npm version

Setup

If you're using the preact-template you'll get this behavior out of the box, if you don't or are using the old version fo it you'll have to follow these instructions.

npm i --save-dev @prefresh/snowpack
## OR
yarn add --dev @prefresh/snowpack

You'll have to add a few things, as seen in this PR.

Add @prefresh/babel-plugin to your babel.config.json:

{
  "presets": [
    [
      "@babel/preset-react",
      {
        "pragma": "h",
        "pragmaFrag": "Fragment"
      }
    ],
    "@babel/preset-typescript"
  ],
  "plugins": ["@babel/plugin-syntax-import-meta", "@prefresh/babel-plugin"]
}

After adding it to your babel-config you'll have to make sure your snowpack.config.json contains both plugin-babel and @prefresh/snowpack

{
  "plugins": ["@snowpack/plugin-babel", "@prefresh/snowpack"]
}

Best practices

Recognition

We need to be able to recognise your components, this means that components should start with a capital letter and hook should start with use followed by a capital letter. This allows the Babel plugin to effectively recognise these.

Do note that a component as seen below is not named.

export default () => {
  return <p>Want to refresh</p>;
};

Instead do:

const Refresh = () => {
  return <p>Want to refresh</p>;
};

export default Refresh;

When you are working with HOC's be sure to lift up the displayName so we can recognise it as a component.

3.2.0

1 year ago

3.1.5

2 years ago

3.1.3

2 years ago

3.1.4

2 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.2.0

3 years ago

2.1.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago

0.4.0

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago