Commit Graph

10 Commits

Author SHA1 Message Date
Kyle McCormick
2769a00e39 build: Remove unneccessary built-in XBlock Sass built steps (#35833)
Since all built-in block Sass is gone, we remove two final pieces of code:

* the steps in `npm run compile-sass` which compiled `xmodule/assets`, and
* the now-unused `add_sass_to_fragment` function.

This should speed up the edx-platform assets build a little bit.
This commit also includes some minor dev doc updates.

Part of: https://github.com/openedx/edx-platform/issues/35300
2024-11-14 14:05:30 +00:00
Kyle D. McCormick
21a1235a28 revert: revert: build: finish replacing paver assets
This reverts commit 4c0284b87d.
2024-05-07 08:40:40 -04:00
Kyle McCormick
4c0284b87d Revert "build: finish replacing paver assets (#34554)" (#34700)
Reverts #34554, which causes compilation of edX.org's
legacy comprehensive theme to be skipped in their deployment pipeline.
We have not determined the precise cause yet, but it seems like the
compile_sass management command is not correctly getting the
list of comprehensive theme directories from Django settings.
2024-05-06 12:57:51 -04:00
Kyle McCormick
3f0f7ce705 build: finish replacing paver assets (#34554)
Together, these changes make it so that all features of the Paver-based
asset compilation system are supported with drop-in Paver-free
replacements. The remaining Paver asset functions are trivial wrappers,
which can be comfortably deleted before Sumac.

* Turn `./manage.py ... compile_sass` into a simple wrapper around `npm
  run compile-sass`
* Turn `paver webpack` into a simple wrapper around `npm run webpack`
* Turn `pavelib.assets:collect_assets` into a simple wrapper around
  `./manage.py ... collectstatic`
* Add/improve deprecation warnings for all Paver asset commands.
* Load defaults for asset-related Django settings from environment
  variables. This allows the build to work without Python. For the
  settings which will be removed in Sumac, I've added deprecation
  warnings.
* Change EDX_PLATFORM_THEME_DIRS env var to COMPREHENSIVE_THEME_DIRS.
  This simplifies the migration instructions, because all the new env
  vars now match their corresponding Django settings. This amends an
  ADR, but it should not be a breaking change because the  env var was
  recently added (since Quince) and nobody should be using it yet.
* Future-proof the static assets ADR with links. The linked pages will
  be kept up-to-date even if the ADR isn't.

Part of: https://github.com/openedx/edx-platform/issues/34467
2024-05-06 08:29:45 -04:00
Kyle D. McCormick
2cd3dc844d fix: NameErrors in compile_sass.py
Fixes three NameErrors which were introduced by the previous commit,
leading to it being reverted.

These NameErrors slipped through because the script was not tested on
any themes that had zero SCSS overrides.
2024-04-12 11:33:31 -04:00
Kyle D. McCormick
f57d412c71 revert: revert: build: remove dependency on Python sass module
This reverts commit a27cda2fd9.
2024-04-12 11:33:31 -04:00
Kyle McCormick
a27cda2fd9 revert: "build: remove dependency on Python sass module (#34439)" (#34476)
This reverts commit a08a10c396.

compile_sass.py had a bug which was caught by 2U's pipeline, but not
by local testing.
2024-04-05 11:59:58 -04:00
Kyle McCormick
a08a10c396 build: remove dependency on Python sass module (#34439)
Instead of using libsass-python's `sass` module, which is incompatible
with Python 3.11, we now directly use libsass-python's `_sass` module,
which directly binds to the underlying C++ libsass library.

This ensures that the Sass build will not a blocker for the edx-platform
Python 3.11 upgrade, which needs to land in Redwood.

For more details, see the docstring at scripts/compile_sass.py#L167
2024-04-05 10:50:05 -04:00
Kyle D. McCormick
bd82b1d75a docs: npm scripts for static assets are no longer experimental :) 2024-04-04 10:31:02 -04:00
Kyle McCormick
3e67719a24 build: npm run build (experimental) (#32823)
This PR implements much of the static assets rework ADR [1], including:

* `npm run build[-dev]`, and its subcommands,
* `npm run webpack[-dev]` and
* `npm run compile-sass[-dev]`.

This is backwards-compatible. `paver update_assets` should not be affected.
The new command warns that it is "experimental" for a few reasons:

* `npm run build` will fail in the webpack phase unless you first
run  `xmodule_assets`. This will be changed soon [2].

* We have tested the new build, but not quite so thoroughly that we'd
recommend it as the production default yet. Once the xmodule_assets
work lands, we'll share this on the forums so early adopters can try it
out.

* The commands lack some top-level documentation. Once they stabilize more,
we'll add a section to the README that explains how and when to use `npm run
build` and its subcommands and its env vars.

* `npm run watch` is not yet implemented.

References:
1. https://github.com/openedx/edx-platform/blob/master/docs/decisions/0017-reimplement-asset-processing.rst
2. https://github.com/openedx/edx-platform/pull/32685

Part of: https://github.com/openedx/edx-platform/issues/31604
2023-07-26 08:04:45 -04:00