2017 © Pedro Peláez
 

project craft

nystudio107 Craft 3 CMS scaffolding project

image

nystudio107/craft

nystudio107 Craft 3 CMS scaffolding project

  • Thursday, May 24, 2018
  • by khalwat
  • Repository
  • 11 Watchers
  • 92 Stars
  • 705 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 20 Forks
  • 2 Open issues
  • 16 Versions
  • 23 % Grown

The README.md

nystudio107, (*1)

About nystudio107/craft

This is an alternate scaffolding package for Craft 3 CMS projects to Pixel & Tonic's canonical craftcms/craft package., (*2)

Vite buildchain

This project uses a Vite.js for the build system as per Vite.js Next Generation Frontend Tooling + Craft CMS, as opposed to the usual webpack buildchain., (*3)

Vite is fast ⚡, (*4)

The project

The project is based on Craft CMS using a unique templates/_boilerplate system for web/AJAX/AMP pages, and implements a number of technologies/techniques:, (*5)

...and probably a bunch of other stuff too., (*6)

The following Craft CMS plugins are used on this site: * FastCGI Cache Bust - to bust the FastCGI cache whenever entries are modified * ImageOptimize - for the optimized images and srcsets used on the site * Minify - to minify the HTML and inline JS/CSS * Retour - for setting up 404 redirects * SEOmatic - for handling site-side SEO * Vite - for loading Vite-generated manifest.json resources in a modern way * Typogrify - for smart quotes and other typographic ligatures * Webperf - for monitoring web performance, (*7)

You can read more about it in the Setting up a New Craft 3 CMS Project article., (*8)

Using nystudio107/craft

This project package works exactly the way Pixel & Tonic's craftcms/craft package works; you create a new project by first creating & installing the project:, (*9)

composer create-project nystudio107/craft PATH --no-install

Make sure that PATH is the path to your project, including the name you want for the project, e.g.:, (*10)

composer create-project nystudio107/craft craft3 --no-install

We use --no-install so that the composer packages for the root project are not installed., (*11)

Setting Up Local Dev

You'll need Docker desktop for your platform installed to run devMode in local development, (*12)

Ensure no other local development environments are running that might have port conflicts, then:, (*13)

  • Start up the site by typing make dev in terminal in the project's root directory (the first build will be somewhat lengthy)
  • Navigate to http://localhost:8000 to use the site; the vite-dev-server runs off of http://localhost:3000

Wait until you see the following to indicate that the PHP container is ready:, (*14)

php_1         | Craft is installed.
php_1         | Applying changes from your project config files ... done
php_1         | [01-Dec-2020 18:38:46] NOTICE: fpm is running, pid 22
php_1         | [01-Dec-2020 18:38:46] NOTICE: ready to handle connections

...and the following to indicate that the Vite container is ready:, (*15)

vite_1        |   vite v2.3.2 dev server running at:
vite_1        |
vite_1        |   > Local:    http://localhost:3000/
vite_1        |   > Network:  http://172.22.0.5:3000/
vite_1        |
vite_1        |   ready in 1573ms.

The CP login credentials are initially set as follows:, (*16)

Login: andrew@nystudio107.com \ Password: letmein, (*17)

Obviously change these to whatever you like as needed., (*18)

Build the production assets by typing make build to build the critical CSS, fonts, and other production assets. They will appear in cms/web/dist/ (just double-click on the report-legacy.html and report-modern.html files to view them)., (*19)

N.B.: Without authorization & credentials (which are private), the make pulldb will not work (it just runs scripts/docker_pull_db.sh). It's provided here for instructional purposes., (*20)

Makefile Project Commands

This project uses Docker to shrink-wrap the devops it needs to run around the project., (*21)

To make using it easier, we're using a Makefile and the built-in make utility to create local aliases. You can run the following from terminal in the project directory:, (*22)

  • make dev - starts up the local dev server listening on http://localhost:8000/
  • make build - builds the static assets via the Vite buildchain
  • make clean - removes the cms/composer.lock & the entire cms/vendor/ directory as well as the buildchain/package-lock.json & the entire buildchain/node_modules/ directory
  • make composer xxx - runs the composer command passed in, e.g. make composer install
  • make craft xxx - runs the craft console command passed in, e.g. make craft project-config/apply in the php container
  • make npm xxx - runs the npm command passed in, e.g. make npm install
  • make nuke - restarts the project from scratch by running make clean (above), then shuts down the Docker containers, removes any mounted volumes (including the database), and then rebuilds the containers from scratch
  • make pulldb - runs the scripts/docker_pull_db.sh script to pull a remote database into the database container; the scripts/.env.sh must be set up first
  • make restoredb xxx - runs the scripts/docker_restore_db.sh script to restore a local database dump into the database container; the scripts/.env.sh must be set up first
  • make ssh - opens up a Unix shell inside the PHP container for the project

Tip: If you try a command like make craft project-config/apply --force you’ll see an error, because the shell thinks the --force flag should be applied to the make command. To side-step this, use the -- (double-dash) to disable further option processing, like this: make -- craft project-config/apply --force, (*23)

Other notes

To use Xdebug with VSCode install the PHP Debug extension and use the following configuration in your .vscode/launch.json:, (*24)

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "log": true,
            "externalConsole": false,
            "pathMappings": {
                "/var/www/project/cms": "${workspaceRoot}/cms"
            },
            "ignore": ["**/vendor/**/*.php"]
        }
    ]
}

Below is the entire intact, unmodified README.md from Pixel & Tonic's craftcms/craft:, (*25)

Roadmap

  • Update to Tailwind CSS ^3.0.0

....., (*26)

Craft CMS, (*27)

About Craft CMS

Craft is a flexible and scalable CMS for creating bespoke digital experiences on the web and beyond., (*28)

It features:, (*29)

Learn more about it at craftcms.com., (*30)

Tech Specs

Craft is written in PHP (7+), and built on the Yii 2 framework. It can connect to MySQL (5.5+) and PostgreSQL (9.5+) for content storage., (*31)

Installation

See the following documentation pages for help installing Craft 3:, (*32)

The Versions