Giter Site home page Giter Site logo

mandrasch / ddev-typo3-vite-svelte Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 5.13 MB

Svelte meets typo3 + vite in DDEV. ๐Ÿงก Fork of fgeierst/typo3-vite-demo.

License: GNU General Public License v2.0

JavaScript 14.48% PHP 45.17% HTML 9.36% CSS 0.62% SCSS 0.53% Shell 27.25% Svelte 2.59%
ddev svelte typo3 vite

ddev-typo3-vite-svelte's Introduction

ddev-typo3-vite-svelte

Svelte meets typo3 + vite in DDEV. ๐Ÿงก

Fork of fgeierst/typo3-vite-demo.

Status: Work in Progress. ๐Ÿง‘โ€๐Ÿ”ง

Screenshot block with svelte input binding

This demo uses:

Thanks very much to @bokunomaxi for typo3 support! Looking for a solution for LaravelMix + Svelte? We're working on a demo repository as well!

Disclaimer: I'm a typo3 noob. Suggestions for improvement welcome ;-)

Local setup (first time)

These are the steps needed after you clone this repository:

ddev start && \
    ddev exec 'cp .env.example .env' && \
    ddev composer install && \
    ddev snapshot restore --latest && \
    ddev npm install && \
    ddev launch

You can access typo3 via https://ddev-typo3-vite-svelte.ddev.site/typo3:

User: admin Password: VwM308w5Xsuxa4C

Local development (vite)

To start local development with vite, run:

ddev npm run dev 

You can also use ddev vite-serve start / ddev vite-serve stop)

Simulate production site (live) locally

Run a vite build for production:

ddev npm run build

Switch applicationContext to production in .env:

# Switch easily between Development/Local and Production/Live
# TYPO3_CONTEXT="Development/Local"
TYPO3_CONTEXT="Production/Live"

How was this created?

Followed steps of DDEV typo3 quickstart docs, but used v11:

ddev config --project-type=typo3 --docroot=public --create-docroot --php-version 8.1 && \
	ddev start && \
	ddev composer create "typo3/cms-base-distribution:^11" --prefer-dist && \
	ddev exec touch public/FIRST_INSTALL && \
	ddev launch

# Finish installation in browser with database:'db',db-user:'db',host:'db'
# Selected option "Create empty starting page"

Custom site package:

Add svelte-demo to the static includes:

Screenshot edit whole template record, tab includes, add svelte-demo

NodeJS Installation:

ddev npm init -y
ddev npm install vite @sveltejs/vite-plugin-svelte --save-dev
  • Added scripts section to package.json:
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  • Created vite.config.js

ddev-viteserve installation:

ddev get torenware/ddev-viteserve
ddev restart

Created .ddev/env for npm:

# start vite
VITE_PROJECT_DIR=.
VITE_PRIMARY_PORT=5173
VITE_SECONDARY_PORT=5273
VITE_JS_PACKAGE_MGR=npm
# end vite

Use dotenv-connector for fast switch between Production/Live and Development/Local:

  • ddev composer req helhum/dotenv-connector

Thanks to https://blog.blue-side.de/2021/02/benutzung-von-env-in-typo3/.

Finally created an HTML block:

  • TODO: Add screenshot for HTML block

Other resources

Looking for LaravelMix? Coming soon! (https://github.com/mandrasch/ddev-typo3-mix-svelte)

Interested in WordPress development? https://github.com/mandrasch/ddev-wp-acf-blocks-svelte

See https://my-ddev-lab.mandrasch.eu/ for more experiments.

TODOs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.