Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specificy less-plugin-clean-css dependency #312

Merged
merged 3 commits into from Aug 1, 2021
Merged

Conversation

DougInAMug
Copy link
Member

Add less-plugin-clean-css to package.json.

After a bit of digging in #311, I found out that specifying this package allows the site to build without error! Perhaps this functionality was earlier part of lessc, and then split off as a plugin? I'm not fully sure why it works, but it works 😅

Copy link
Member

@shinenelson shinenelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you not notice that there is "@wikimedia/less-plugin-clean-css": "^1.5.2" also listed in the devDependencies section?

"@wikimedia/less-plugin-clean-css": "^1.5.2",

It is an organization-scoped dependency with no apparent modifications other than the organization scoping.

I could not figure out why the organization-scoped dependency would not work. But I did not spend too much time investigating either. If you have found the non-organization-scoped dependency to work well, you should probably replace the dependencies.

With all that said, I am slowly revamping the whole website to use jekyll and GitHub Pages more efficiently ( read natively ). Which means that the lessc dependency might go away completely.

@DougInAMug
Copy link
Member Author

No, I didn't notice that! Curiouse... The @wikimedia version seems to show a conflict between the badge version and the npm version? https://www.npmjs.com/package/@wikimedia/less-plugin-clean-css hmm...

@DougInAMug
Copy link
Member Author

So even "@wikimedia/less-plugin-clean-css": "^1.5.1" didn't work 🤔 so I removed that plugin entirely. I checked, and this update also works fine with Ubuntu 18.04.

Did you try it out, to see if it runs your end?

package.json Outdated
@@ -23,10 +23,9 @@
"license": "(OFL-1.1 AND MIT)",
"dependencies": {},
"devDependencies": {
"@wikimedia/less-plugin-clean-css": "^1.5.2",
"less-plugin-clean-css": "^1.5.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Package dependencies are inserted in lexical order by the npm CLI. That means that the next time a new package is added to the set, this line will be re-ordered to under the less dependency making an unrelated change at that point. Hence, it is better to keep it at line 29 in this change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this should probably also have an accompanying change in package-lock.json

@shinenelson
Copy link
Member

The @wikimedia version seems to show a conflict between the badge version and the npm version

Badges are links to hosted SVG files. Since https://github.com/wikimedia/less-plugin-clean-css is a fork of https://github.com/less/less-plugin-clean-css, they probably inherited the badge from the source project and did not bother to change it. The only visible change they made was to scope the package to the organization, bump the version and publish it to the NPM registry

PS : badges on readmes should not be considered to be sources of truth.

So even "@wikimedia/less-plugin-clean-css": "^1.5.1" didn't work

It would not because @wikimedia/less-plugin-clean-css has only one published version so it would always pick that one as long as you specify a compatible version.

Investigating deeper, I found that the 2 packages lock different major versions of clean-css which could possibly be the reason for different kind of behavior even though one is a fork of the other.

+-- @wikimedia/less-plugin-clean-css@1.5.2
| `-- clean-css@4.2.3
|   `-- source-map@0.6.1 deduped
+-- less-plugin-clean-css@1.5.1
| `-- clean-css@3.4.28
|   +-- commander@2.8.1
|   | `-- graceful-readlink@1.0.1
|   `-- source-map@0.4.4
|     `-- amdefine@1.0.1

PS : the ^ in the version specifier implies any version greater than or equal to the specified version.

Did you try it out, to see if it runs your end?

I have not put in too much effort into this since I am more invested in testing the ruby version dependency that I mentioned in https://github.com/ForkAwesome/Fork-Awesome/pull/309/files#r677254767. I will, however, test this one too with a couple of ruby versions and report back.

@shinenelson
Copy link
Member

I spent time investigating this issue. I have detailed my findings in #311 (comment).

The solution that I came up with is :

diff --git a/package.json b/package.json
index 933df7318..9720e7afc 100644
--- a/package.json
+++ b/package.json
@@ -23,9 +23,9 @@
   "license": "(OFL-1.1 AND MIT)",
   "dependencies": {},
   "devDependencies": {
-    "@wikimedia/less-plugin-clean-css": "^1.5.2",
     "all-contributors-cli": "^6.16.0",
     "less": "^3.11.3",
+    "less-plugin-clean-css": "less/less-plugin-clean-css#master",
     "svgo": "^1.3.2"
   },
   "engines": {

Apply this patch and see if it still works for you.

@DougInAMug
Copy link
Member Author

Going to merge this! Half way to finishing #311 !

@DougInAMug DougInAMug merged commit 127f26c into master Aug 1, 2021
@DougInAMug DougInAMug deleted the less-plugin-clean-css branch August 1, 2021 14:51
shinenelson added a commit to shinenelson/Fork-Awesome that referenced this pull request Aug 3, 2021
which should have gone together with ForkAwesome#312

reference : ForkAwesome#312
shinenelson added a commit that referenced this pull request Aug 3, 2021
which should have gone together with #312

reference : #312
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants