Giter Site home page Giter Site logo

onedarnleyroad / craftcms Goto Github PK

View Code? Open in Web Editor NEW
67.0 67.0 21.0 497 KB

A Craft CMS starter project using DDEV for local hosting and Vite for front-end bundling and HMR.

License: MIT License

PHP 38.26% JavaScript 7.89% Twig 50.24% Makefile 3.00% CSS 0.62%
alpinejs composer craftcms ddev docker npm tailwindcss vitejs

craftcms's People

Contributors

johndwells avatar mckenzieclark avatar saltymouse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

craftcms's Issues

Vite won't start up after a fresh install

Installed already a couple of times following your instructions. But I keep getting the following issue.

` VITE v4.5.2 ready in 329 ms

➜ Local: http://localhost:3000/
➜ Network: http://172.27.0.3:3000/
➜ Network: http://192.168.208.3:3000/
➜ press h to show help

Shortcuts
press r to restart the server
press u to show server url
press o to open in browser
press c to clear console
press q to quit
node:events:491
throw er; // Unhandled 'error' event
^

Error: spawn xdg-open ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
at onErrorNT (node:internal/child_process:485:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
at onErrorNT (node:internal/child_process:485:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn xdg-open',
path: 'xdg-open',
spawnargs: [ 'http://localhost:3000/' ]
}
Failed to execute command npm run serve: exit status 1
make: *** [dev] Error 1`

Critical CSS to prevent FUOC

Very cool Project!
have you tried to include critical css? I am currently working on a similar project and have an issue connected to puppeteer on my Mac M1 Max in ddev web container.
This are the containers specs
Linux craftcms-web 5.10.104-linuxkit #1 SMP PREEMPT Thu Mar 17 17:05:54 UTC 2022 aarch64 GNU/Linux

I used the rollup-plugin-critical https://github.com/nystudio107/rollup-plugin-critical Plugin which works perfekt in an MAMP Environment. Did all the necessary configs for ddev/docker described here https://nystudio107.com/docs/vite/#local-development-environment-setup

Set @web alias to DEFAULT_SITE_URL

@web shouldn't be dynamically set in production, so the accepted convention right now is:

  1. define DEFAULT_SITE_URL environment variable; and
  2. assign @web alias to that in general.php, e.g.
'aliases' => [
'@web' => env('DEFAULT_SITE_URL') ?? null
]

Create a static offline HTML file available in /web

On occasion, we need to take a site offline in front of Craft. For instance, if a big deployment is required, and we need to be able to respond to the visitor with an "offline" message without hitting Craft. With a simple, static "offline" HTML file available in /web, it's easy to create a symlink of index.php and point to this offline file during the deployment.

Remove `.ddev` from repository

Version-controlling the .ddev folder is a Bad Idea, since the config's contents will change, depending on what version of DDEV is installed locally.

Use URL Manager to get matched element for CP edit button

Instead of this:

{% set element = craft.app.elements().getElementByUri(craft.app.request.getFullUri() ?: '__home__') %}

We should be doing this:

{% set element = craft.app.getUrlManager().getMatchedElement() %}

The URL Manager already has a memoized copy of the element.

Add default _errors templates

We should start with boilerplate error template(s) that give us a better-than-default error page. Centre the logo & text, use tailwind, remove any content that might come from the DB.

Add config file for Imager

We should ensure that imagerUrl is always absolute, so that image transforms in things like HTML emails use absolute URLs:

<?php

return [
	// absolute URLs so that transformed images in emails work
	'imagerUrl' => '@web/imager/'
];

Add a starter config/one.php

Among others we like to set environment, site version, and google analytics ID to a site-specific config file (so keep general.php clean).

Update dotenv

If we upgrade to the latest way that Craft does it, be sure to also:

  • update web/index.php
  • update craft
  • add boostrap.php

Makefile command for seeding a db instead of install

At a minimum something like this:

install: up build
  ddev exec php craft setup/app-id \
    $(filter-out $@,$(MAKECMDGOALS))
  ddev exec php craft setup/security-key \
    $(filter-out $@,$(MAKECMDGOALS))
  ddev import-db --src=seed.sql
  ddev exec php craft up

But it might be cool to modify install to accept a flag? e.g. install --seed=snapshot.sql

Module idea: a better `knock-knock`

We often need to password-protect a site during development, and while there is this: https://github.com/verbb/knock-knock/

It has some shortcomings, namely that the login template is not at all customisable. And while it isn't too difficult to spin up a basic front-end login form for Craft users, it requires sharing a username/email and password, but typically during the development phase it's preferred to share a memorable and simple password only (so no username/email combo and no need to have a system user).

The boilerplate version could use cdn-hosted Tailwind that could likely be swapped out for a real site's tailwind with little customising necessary. It might also pair nicely with some boilerplate error pages... perhaps there is a possibility of sharing layouts?

allowAdminChanges seems incorrect setting for production

Our general.php config has this:

'allowAdminChanges' => false

Which seems wrong. It makes sense using project config, but we do not use projectConfig, and I can't see us using it any time soon, so we just end up being unable to administer the Production database, which is always supposed the single source of truth in the long run.

Use `@web` for site url

Change from using $PRIMARY_SITE_URL to @web, which I believe is more like the Craft convention. We do explicitly set @web in our general/config.php which is the important thing.

Error w/Default Mail Setup

Are there subsequent steps one should take to have mail working or has something broken? I am not doing more than testing the email config of a default installation.

Screenshot 2022-02-18 at 11 51 14

"with git" proposal: recommend degit over clone, and add init steps to Makefile

Great to see someone's ddev Craft CMS setup!

I tried it out, installing via Composer, and immediately hit #38. Saw the fix was merged, so tried again following your instructions for installing with Git.
My impression: two changes would make it even easier for people to start from the unreleased bleeding edge

  • using degit instead of git-clone would obviate the need to manually remove the .git directory
  • moving the "clean up and set" commands into the Makefile (not sure what name would be best. make init?) would reduce 4 steps to 1

I can make a pull request if you like the idea.

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.