All Projects → DeMoorJasper → Parcel Plugin Svelte

DeMoorJasper / Parcel Plugin Svelte

Licence: mit
A parcel plugin that enables svelte support

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Parcel Plugin Svelte

Wg Ui
WireGuard Web UI for self-serve client configurations, with optional auth.
Stars: ✭ 690 (+222.43%)
Mutual labels:  hacktoberfest, svelte
Svelte Preprocess
A ✨ magical ✨ Svelte preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, Coffeescript, TypeScript, Pug and much more.
Stars: ✭ 970 (+353.27%)
Mutual labels:  hacktoberfest, svelte
Obs Web
OBS-web - the easiest way to control OBS remotely
Stars: ✭ 512 (+139.25%)
Mutual labels:  hacktoberfest, svelte
Svelte I18n
Internationalization library for Svelte
Stars: ✭ 433 (+102.34%)
Mutual labels:  hacktoberfest, svelte
Musicplayer
A minimal music player built on electron.
Stars: ✭ 145 (-32.24%)
Mutual labels:  hacktoberfest, svelte
Svelte Typescript Parcel
Svelte + Typescript + Parcel
Stars: ✭ 48 (-77.57%)
Mutual labels:  parcel, svelte
Revelt
Analysis of a project using React and Svelte technologies
Stars: ✭ 20 (-90.65%)
Mutual labels:  hacktoberfest, svelte
Sveltejs Forms
Declarative forms for Svelte
Stars: ✭ 163 (-23.83%)
Mutual labels:  hacktoberfest, svelte
Svelte Firebase
A template to help you start developing SPAs with Svelte and Firebase.
Stars: ✭ 111 (-48.13%)
Mutual labels:  hacktoberfest, svelte
Svelte Template
🚧 An easy-to-use Svelte template! (Svelte + Typescript + Parcel + Express) 2020
Stars: ✭ 88 (-58.88%)
Mutual labels:  parcel, svelte
Ajari Koding
📚 Kumpulan berbagai sumber daya untuk belajar koding dari hasil karya para kreator lokal yang terpercaya dan telah dikurasi oleh komunitas PHPID
Stars: ✭ 156 (-27.1%)
Mutual labels:  hacktoberfest, svelte
Svelte Storybook Tailwind
A starter template for Svelte, TailwindCSS and Storybook. You can easily start your project with this template, instead of wasting time figuring out configurations for each integration.
Stars: ✭ 204 (-4.67%)
Mutual labels:  hacktoberfest, svelte
Bookmarks
🔖 +4.3K awesome resources for geeks and software crafters 🍺
Stars: ✭ 210 (-1.87%)
Mutual labels:  hacktoberfest
Cve Bin Tool
This tool scans for a number of common, vulnerable components (openssl, libpng, libxml2, expat and a few others) to let you know if your system includes common libraries with known vulnerabilities.
Stars: ✭ 211 (-1.4%)
Mutual labels:  hacktoberfest
Tldr
Golang command line client for tldr https://github.com/tldr-pages/tldr
Stars: ✭ 210 (-1.87%)
Mutual labels:  hacktoberfest
Svelte Vscode
Svelte language support for VS Code
Stars: ✭ 211 (-1.4%)
Mutual labels:  svelte
Ember Feature Flags
Ember CLI addon for feature flags
Stars: ✭ 212 (-0.93%)
Mutual labels:  hacktoberfest
Pytest Qt
pytest plugin for Qt (PyQt4, PyQt5 and PySide) application testing
Stars: ✭ 210 (-1.87%)
Mutual labels:  hacktoberfest
Pixieditor
PixiEditor is a lightweight pixel art editor made with .NET 5
Stars: ✭ 210 (-1.87%)
Mutual labels:  hacktoberfest
Opensourceresources
Free opensource Learning Resources related to Web-Development A to Z 🔥❤
Stars: ✭ 210 (-1.87%)
Mutual labels:  hacktoberfest

parcel-plugin-svelte

Build Status

A parcel plugin that enables svelte support

Getting Started

Install dependencies

yarn add svelte parcel-bundler parcel-plugin-svelte @babel/polyfill -D

Update the package.json

Update your package.json to contain these scripts (for more information on these commands, see: https://parceljs.org/cli.html):

{
  "scripts": {
    "start": "parcel index.html",
    "build": "parcel build index.html"
  }
}

Create the files

Create an html file that will be used as the entrypoint, name it index.html:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Parcel Plugin Svelte Example</title>
  </head>
  <body>
    <div id="demo"></div>

    <!-- This script tag points to the source of the JS file we want to load and bundle -->
    <script src="main.js"></script>
  </body>
</html>

Create a simple JavaScript file named main.js:

import '@babel/polyfill';
import App from './App.svelte';

new App({
  target: document.getElementById('demo'),
  props: {
    name: 'world'
  }
});

Create a Svelte file named App.svelte:

<p>
  Hello { name }, the time is <span class="the-time">{ hours }:{ minutes }:{ seconds }</span>
</p>

<style>
  .the-time {
    font-weight: bold;
  }
</style>

<script>
  import { onMount } from 'svelte';

  export let name = 'Anonymous';
  let time = new Date();

  onMount(() => {
    const timer = setInterval(() => {
      time = new Date();
    }, 1000)

    return () => {
      clearInterval(timer);
    }
  })

  let hours, minutes, seconds;

  $: {
    hours = time.getHours();
    minutes = time.getMinutes();
    seconds = time.getSeconds();
  }
</script>

Further reading

To continue your journey into Svelte and Parcel please have a look at their documentation:

for configuring this plugin, please read #Configuration

Configuration

The default configuration should work for most people but for anyone who would like to change the way svelte compiles the files there is the possibility to configure it.

This can be done though a svelte.config.js file, .svelterc file or svelte field in package.json.

For documentation on which parameters you can set and use look at the official svelte docs.

// Used by svelte.compilerOptions
compilerOptions: {
  ...
},
// Used by svelte.preprocess
preprocess: {
  ...
}

Note: the use of compiler property will be deprecated on the next major version, you should use thecompilerOptions property instead.

CSS CompilerOptions

If you set compilerOptions.css to false, CSS will be bundled in a separate file. It also enables post-transformations provided by Parcel such as PostCSS and file resolution for url().

How does it work?

If you want to know how it works have a look at my article about this plugin, might help if you wanna fix a bug or write your own parcel-plugin.

Any more questions?

Any more questions about how the plugin works internally or how to use it? Feel free to open an issue in the repository.

License

This project is licensed under the MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].