Coder Social home page Coder Social logo

_template-vite-craft-v5's Introduction

Welcome to the Craft 5 with Vite.

Table of Contents


  1. Requirements
  2. Build Tools & Assets
  3. Getting Started
  4. Build Commands

Installation requirements


  • Node.js
  • NPM
  • Composer
  • Vite

Tools & Frontend Assets


What's included:

  • Craft CMS v5 - Craft is a flexible, user-friendly CMS for creating custom digital experiences on the web and beyond. Documentation
  • Vite - Documentation

Frontend assets:

Getting Started


Configuring enviroment

Make sure .env variables are updated with the appropriate values. They are used for all frontend build commands. Below are the values used by the frontend build commands.

ENVIRONMENT

Is used to set whether development or production version of files are generated. Expected values are development, dev, staging, or production.

Important note about sites behind HTTP authentication:

Because this site uses the vite plugin, if your site is behind HTTP authentication - you will have to update the HTTP_AUTHENTICATION_USER and HTTP_AUTHENTICATION_PASSWORD in the .env file to make sure pulling in vite build files is working properly.

PRIMARY_SITE_URL

Must be set for Vite plugin and Craft to work properly.

Configuring paths

WARNING: Whatever is inside the folder ./web/dist will be deleted whenever you run npm run build. This is to prevent caching of old build files. Be careful not to put anything else inside this folder.

Setting up purging of TailwindCSS

Make sure in your package.json that "purgeFiles": [] contains an array to any files that contain tailwindcss classes. To learn more go to tailwindcss documentation about (optimizing for production)[https://tailwindcss.com/docs/optimizing-for-production].

Customizing Webpack

Set any custom configuration (e.g. new entry points or other settings) in vite.config.js.

Favicons

Favicon generation uses Real Favicon Generator. Edit ./faviconConfig.json to be valid Real Favicon Generator configuration.

Build Commands


npm run build

Builds production frontend files using vite.

npm run dev

Builds development frontend files and watches for changes. In order for this to work properly, make sure the craft environment is set to dev or development.

npm run favicon

Generates favicon information using real favicon generator.

npm run favicon-update

Checks real favicon generator for any updates.

_template-vite-craft-v5's People

Contributors

twitcher07 avatar

Watchers

 avatar

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.