@webdevandsausages/mailing-list-widget
v0.1.0
Published
A widget for joining the Web Dev & Sausages mailing list
Downloads
4
Readme
@webdevandsauages/mailing-list-widget
This is component is intended for use in webdevandsausages.org and is not suitable for other projects. The original boilerplate is from svelte component template.
Table of Contents
Getting Started usin the component
npm i @webdevandsauages/mailing-list-widget --save
Include in your project
<script>
import {JoinMailingList} from '@webdevandsausages/event-terminal'
</script>
<div>
{#if process.browser}
<JoinMailingList />
{/if}
</div>
Developing
- Start Rollup:
npm run dev
Edit a component file in
src/components
, save it, and reload the page to see your changes.Make sure your component is exported in
src/components/components.module.js
.Make sure your component is imported and nested in
src/App.svelte
.Navigate to localhost:3000 to see your components live.
In development the express dev server will proxy
/api
requests tolocalhost:5000
Consuming Components
Your package.json has a "svelte"
field pointing to src/components/components.module.js
, which allows Svelte apps to import the source code directly, if they are using a bundler plugin like rollup-plugin-svelte or svelte-loader (where resolve.mainFields
in your webpack config includes "svelte"
). This is recommended.
For everyone else, npm run build
will bundle your component's source code into a plain JavaScript module (index.mjs
) and a UMD script (index.js
), in the dist
folder.
This will happen automatically when you publish your component to npm, courtesy of the prepublishOnly
hook in package.json.
Backward Compatibility
This template uses svelte-preprocess in order to integrate PostCSS auto-prefixing capabilities into the build process.
Browserlist
PostCSS
uses browserlist under the hood, in order to "know" what css to prefix.
The browserlist
configuration is located inside the package.json
.
Preprocessors
This template comes with the svelte-preprocess by default, which simplifies the use of preprocessors in components.