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
6 changes: 3 additions & 3 deletions .github/workflows/check-npm-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
paths:
- 'package*.json'
- 'gulpfile.js'
- 'pelican/themes/reflex/static/stylesheet/**/*.less'
- 'pelican/themes/reflex/static/dark-theme/**/*.js'
- 'pelican/themes/reflex/static/pygments/**/*.css'
- 'static/stylesheet/**/*.less'
- 'static/dark-theme/**/*.js'
- 'static/pygments/**/*.css'
- '.github/workflows/check-npm-build.yml'
workflow_call:

Expand Down
45 changes: 23 additions & 22 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ make publish
### File Naming

- Templates: lowercase with hyphens (e.g., `base.html`, `dark-theme.less`)
- Partials: place in pelican/themes/reflex/templates/partial/ directory
- Partials: place in templates/partial/ directory
- Stylesheets: use `.less` extension for source, `.min.css` for compiled
- JavaScript: use `.js` extension for source, `.min.js` for minified

Expand All @@ -101,23 +101,24 @@ make publish
.
├── pelican/
│ └── themes/
│ └── reflex/ # Theme package
│ ├── __init__.py # path() function for Pelican
│ ├── static/ # Static assets
│ │ ├── stylesheet/ # LESS/CSS files
│ │ ├── dark-theme/ # Dark theme JS
│ │ ├── pygments/ # Code highlighting styles
│ │ └── font-awesome/ # Font Awesome assets
│ ├── templates/ # Jinja2 templates
│ │ ├── partial/ # Reusable template partials
│ │ ├── base.html # Base template
│ │ ├── article.html # Article page
│ │ └── index.html # Index page
│ └── translations/ # i18n translations
├── docs/ # Documentation
├── example/ # Example Pelican site
├── gulpfile.js # Gulp build configuration
└── package.json # Node.js dependencies
│ └── reflex/
│ └── __init__.py # path() function for Pelican
├── static/ # Static assets
│ ├── stylesheet/ # LESS/CSS files
│ ├── dark-theme/ # Dark theme JS
│ ├── pygments/ # Code highlighting styles
│ └── font-awesome/ # Font Awesome assets
├── templates/ # Jinja2 templates
│ ├── partial/ # Reusable template partials
│ ├── base.html # Base template
│ ├── article.html # Article page
│ └── index.html # Index page
├── translations/ # i18n translations
├── docs/ # Documentation
├── example/ # Example Pelican site
├── gulpfile.js # Gulp build configuration
├── pdm_build.py # Build hook for package distribution
└── package.json # Node.js dependencies
```

## Testing
Expand All @@ -144,21 +145,21 @@ make publish

### Adding a New Template Partial

1. Create file in `pelican/themes/reflex/templates/partial/`
1. Create file in `templates/partial/`
2. Include in base.html or relevant template
3. Follow 2-space indentation
4. Use existing partials as reference

### Adding New Styles

1. Edit appropriate `.less` file in `pelican/themes/reflex/static/stylesheet/`
1. Edit appropriate `.less` file in `static/stylesheet/`
2. Use variables from `variables.less`
3. Run `gulp less` or `npm run watch` to compile
4. Test in both light and dark themes

### Adding JavaScript

1. Edit source file in `pelican/themes/reflex/static/dark-theme/`
1. Edit source file in `static/dark-theme/`
2. Run `gulp uglify` to minify
3. Ensure minified version is referenced in templates

Expand All @@ -183,6 +184,6 @@ PyPI publishing is automated via the `pypi-publish.yml` workflow when a `v*` tag
- Always rebuild assets (`npm run build`) before committing
- A PR check (`check-npm-build.yml`) verifies that built assets are up to date; PRs with stale assets cannot be merged
- The theme supports both light and dark modes
- Font Awesome is copied from node_modules to pelican/themes/reflex/static/
- Font Awesome is copied from node_modules to static/
- Pygments styles are minified but kept as separate files
- No linting tools are configured - follow existing code style
2 changes: 1 addition & 1 deletion example/pelicanconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

ROBOTS = "index, follow"

THEME = "../pelican/themes/reflex"
THEME = ".."
PATH = "content"
OUTPUT_PATH = "blog/"
TIMEZONE = "UTC"
Expand Down
20 changes: 10 additions & 10 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,46 @@ var gulp = require('gulp'),

gulp.task('less', function () {
return gulp.src([
'./pelican/themes/reflex/static/stylesheet/dark-theme.less',
'./pelican/themes/reflex/static/stylesheet/style.less',
'./static/stylesheet/dark-theme.less',
'./static/stylesheet/style.less',
])
.pipe(less())
.pipe(postcss([cssnano()]))
.pipe(rename({
extname: '.min.css'
}))
.pipe(gulp.dest('./pelican/themes/reflex/static/stylesheet'));
.pipe(gulp.dest('./static/stylesheet'));
});

gulp.task('uglify', function () {
return gulp.src('./pelican/themes/reflex/static/dark-theme/dark-theme.js')
return gulp.src('./static/dark-theme/dark-theme.js')
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest('./pelican/themes/reflex/static/dark-theme'));
.pipe(gulp.dest('./static/dark-theme'));
});

gulp.task('cp', function () {
return gulp.src('./node_modules/font-awesome/**/*.{min.css,otf,eot,svg,ttf,woff,woff2}')
.pipe(gulp.dest('./pelican/themes/reflex/static/font-awesome'));
.pipe(gulp.dest('./static/font-awesome'));
});

gulp.task('pygments', function () {
return gulp.src(['./pelican/themes/reflex/static/pygments/*.css', '!./pelican/themes/reflex/static/pygments/*min.css'])
return gulp.src(['./static/pygments/*.css', '!./static/pygments/*min.css'])
.pipe(postcss([cssnano()]))
.pipe(rename({
extname: '.min.css'
}))
.pipe(gulp.dest('./pelican/themes/reflex/static/pygments'));
.pipe(gulp.dest('./static/pygments'));
});

gulp.task('watch-less', function () {
return gulp.watch('pelican/themes/reflex/static/stylesheet/*.less', gulp.task('less'));
return gulp.watch('static/stylesheet/*.less', gulp.task('less'));
});

gulp.task('watch-js', function () {
return gulp.watch('pelican/themes/reflex/static/dark-theme/!(*.min).js', gulp.task('uglify'));
return gulp.watch('static/dark-theme/!(*.min).js', gulp.task('uglify'));
})

gulp.task('default', gulp.series(['less', 'uglify', 'cp', 'pygments']));
Expand Down
17 changes: 17 additions & 0 deletions pdm_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from pathlib import Path


def pdm_build_update_files(context, files):
if context.target != "wheel":
return

for dirname in ["static", "templates", "translations"]:
to_rename = [
(relpath, local_path)
for relpath, local_path in list(files.items())
if relpath.startswith(f"{dirname}/")
]
for relpath, local_path in to_rename:
del files[relpath]
new_relpath = f"pelican/themes/reflex/{relpath}"
files[new_relpath] = local_path
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ build-backend = "pdm.backend"
[tool.pdm.build]
includes = [
"pelican/",
"static/",
"templates/",
"translations/",
]
excludes = [
"**/.DS_Store",
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.