Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
#
# $ git config --global core.excludesfile ~/.gitignore_global

.sass-cache/
docs/build
media/*
static-root/
static/stylesheets/mq.css
static/stylesheets/no-mq.css
static/stylesheets/style.css
static/css/*.min.css
__pycache__
*.db
*.py[co]
Expand Down
10 changes: 0 additions & 10 deletions Dockerfile.static

This file was deleted.

11 changes: 0 additions & 11 deletions Gemfile

This file was deleted.

28 changes: 0 additions & 28 deletions Gemfile.lock

This file was deleted.

15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,21 @@ docs-clean: ## Clean built documentation
@rm -rf docs/_build
@echo "=> Removed existing documentation build assets"

# =============================================================================
# Frontend
# =============================================================================

##@ Frontend

css: ## Minify CSS with Lightning CSS
npx lightningcss-cli --minify static/css/style.css -o static/css/style.min.css
npx lightningcss-cli --minify static/css/mq.css -o static/css/mq.min.css

css-check: ## Validate CSS parses without errors
npx lightningcss-cli --minify static/css/style.css -o /dev/null
npx lightningcss-cli --minify static/css/mq.css -o /dev/null

.PHONY: help serve migrations migrate manage shell docker_shell clean
.PHONY: lint fmt test ci
.PHONY: docs docs-serve docs-clean
.PHONY: css css-check
3 changes: 0 additions & 3 deletions bin/static

This file was deleted.

7 changes: 0 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ services:
test: ["CMD", "redis-cli","ping"]
interval: 1s

static:
command: bin/static
build:
dockerfile: Dockerfile.static
volumes:
- .:/code

web:
build: .
image: pythondotorg:docker-compose
Expand Down
30 changes: 13 additions & 17 deletions docs/source/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,11 @@ Whichever database type you chose, now it's time to run migrations:
$ ./manage.py migrate
```

To compile and compress static media, you will need *compass* and *yui-compressor*:
To minify CSS (optional for development):

```
$ gem install bundler
$ bundle install
```

```{note}
To install *yui-compressor*, use your OS's package manager or download it directly then add the executable to your `PATH`.
$ npm install
$ make css
```

To create initial data for the most used applications, run:
Expand All @@ -194,20 +190,20 @@ The search feature in Python.org uses Elasticsearch engine. If you want to test

Once you have it installed, update the URL value of `HAYSTACK_CONNECTIONS` settings in `pydotorg/settings/local.py` to your local ElasticSearch server.

Generating CSS files automatically
----------------------------------
Working with CSS
----------------

```{warning}
When editing frontend styles, ensure you ONLY edit the `.scss` files.
The site's CSS source files are in `static/css/`. These are plain CSS files
(no preprocessor required). To minify them for production using
[Lightning CSS](https://lightningcss.dev/):

These will then be compiled into `.css` files automatically.
```
npm install
make css
```

Static files are automatically compiled inside the [Docker Compose `static` container](../../docker-compose.yml)
when running `make serve`.

When your pull request has stylesheet changes, commit the `.scss` files and the compiled `.css` files.
Otherwise, ignore committing and pushing the `.css` files.
When your pull request has stylesheet changes, commit the modified `.css` files
in `static/css/`.

Running tests
-------------
Expand Down
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"name": "pythondotorg",
"description": "Django App behind python.org"
"description": "Django App behind python.org",
"devDependencies": {
"lightningcss-cli": "^1.28.0"
},
"scripts": {
"css:minify": "npx lightningcss-cli --minify static/css/style.css -o static/css/style.min.css && npx lightningcss-cli --minify static/css/mq.css -o static/css/mq.min.css",
"css:check": "npx lightningcss-cli --minify static/css/style.css -o /dev/null && npx lightningcss-cli --minify static/css/mq.css -o /dev/null"
}
}
10 changes: 0 additions & 10 deletions pydotorg/compilers.py

This file was deleted.

4 changes: 2 additions & 2 deletions pydotorg/settings/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

PIPELINE_CSS = {
"style": {
"source_filenames": ("sass/style.css",),
"source_filenames": ("css/style.css",),
"output_filename": "stylesheets/style.css",
"extra_context": {
"title": "default",
"media": "",
},
},
"mq": {
"source_filenames": ("sass/mq.css",),
"source_filenames": ("css/mq.css",),
"output_filename": "stylesheets/mq.css",
"extra_context": {
"media": "not print, braille, embossed, speech, tty",
Expand Down
36 changes: 0 additions & 36 deletions static/config.rb

This file was deleted.

File renamed without changes.
33 changes: 26 additions & 7 deletions static/sass/style.css → static/css/style.css

Large diffs are not rendered by default.

18 changes: 0 additions & 18 deletions static/sass/_FIX-THESE

This file was deleted.

Loading