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

Feature/rewrite urls #3248

Merged
merged 23 commits into from
Jul 18, 2018
Merged

Feature/rewrite urls #3248

merged 23 commits into from
Jul 18, 2018

Conversation

matthew-dean
Copy link
Member

@matthew-dean matthew-dean commented Jun 30, 2018

Moved from #3041

jhnns and others added 16 commits March 27, 2017 19:06
- Rename isPathRelative to pathRequiresRewrite
- Add special handling for rewriteUrls=relative
- Add rewritePath for path rewriting
- Ensure that explicit relative paths stay explicit relative
- Remove code style inconsistencies
- Rename explicit-relative to local
- Add rewrite-urls argument validation
- Replace unknown CSS property background-url with background-image

Based on discussion #3041
- Remove redundant tests
- Add rootpath-rewrite-urls-all test
- Add rootpath-rewrite-urls-local test
@matthew-dean
Copy link
Member Author

I closed this and re-opened a PR with fixed tests. See: #3248.

Are there any error cases missing? Can rewrite URLs cause an error?

If this looks good, we can merge. Thanks @jhnns!

@calvinjuarez
Copy link
Member

calvinjuarez commented Jul 7, 2018

Tests failing. The failure is the same as some other PRs.

jasmine:rootpathRewriteUrls
[secure].js browser test - rootpath and rewrite urls
   - original-[secure]:test-[secure]-urls should match the expected output......X
     ReferenceError: Can't find variable: Promise in http://localhost:8081/test/browser/common.js (line 252) (1)

@matthew-dean
Copy link
Member Author

@calvinjuarez I think this is something wrong with our tests rather than the PR, since it happens everywhere and also happens randomly (and doesn't happen for Appveyor). Maybe some polyfill is loading asynchronously in Node 9 for PhantomJS?

@matthew-dean
Copy link
Member Author

This should probably wait until #3274 is merged and then do the "options upgrade" the same way.

calvinjuarez and others added 3 commits July 11, 2018 14:32
* WIP - Added strictMath: 'division' option

* Removes `less-rhino` (broken for a long time) - Fixes #3241

* Expressions require a delimiter of some kind in mixin args

* Removes "double paren" issue for boolean / if function

* WIP each() re-implementation

* Allows plain conditions without parentheses

* Added each() and tests

* Added tests calling mixins from each()

* Fixes #1880 - Adds two new math modes and deprecates strictMath

* Allows named args for detached ruleset (anonymous mixin)

* Makes sure this doesn't regress needing parens around mixin guard conditions

* Remove javascriptEnabled from browser options check, add to defaults

* Workaround weird Jasmine conversion of < to HTML entity

* Removes remaining Rhino cruft

* Remove rhino files from bower

* Bump Jasmine version

* Added .() example to each

* v3.6.0

* Update CHANGELOG.md

* add explicit nested anonymous mixin test

* add explicit nested anonymous mixin test result

* derp: align test with expected output

* v3.7.0 (#3279)

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md
# Conflicts:
#	bin/lessc
#	lib/less-browser/add-default-options.js
#	lib/less-node/lessc-helper.js
#	lib/less/parse.js
#	test/index.js
#	test/less/math/parens-division/parens.less
#	test/less/math/strict/parens.less
#	test/less/strict-math/parens.less
@matthew-dean
Copy link
Member Author

I redid this branch to use the same "upgrade" pattern as the strictMath-to-math upgrade pattern.

That is, any options sent to parse() or render() are translated from string values to constants. I'm not sure it'll make a huge difference in evaluation time, but string comparisons during evaluation for options seemed unnecessary. Ideally all options would be either integer checks or booleans.

@matthew-dean
Copy link
Member Author

@less/core

Since I don't have a firm grasp of this feature, I think it the tests should be reviewed by @jhnns and others before this is merged to see if the input/output is intuitive and as expected. I didn't really verify the feature; I just got it working / synced with master.

Copy link
Member

@calvinjuarez calvinjuarez left a comment

Choose a reason for hiding this comment

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

I'm not sure I'm fully qualified to pass this one off, since I haven't been following the issue, but I'll work my way through the code. For now, just a couple questions/thoughts.

We could add tests for the deprecation warning to the Grunt opts test.

Gruntfile.js @ ln. 204

'node bin/lessc --relative-urls test/less/lazy-eval.less tmp/lazy-eval.css',

@@ -4,7 +4,7 @@ var path = require('path'),
fs = require('../lib/less-node/fs'),
os = require('os'),
utils = require('../lib/less/utils'),
MATH = require('../lib/less/math-constants'),
Constants = require('../lib/less/constants'),

This comment was marked as resolved.

bin/lessc Outdated
case 'relative-urls':
options.relativeUrls = true;
console.warn('The relative-urls option has been replaced by the rewrite-urls option and will be removed.');
Copy link
Member

Choose a reason for hiding this comment

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

Consider rephrasing to match other deprecation warnings?

The --relative-urls option has been deprecated. Use --rewrite-urls=all.

(I'm not entirely sure which rewrite-urls corresponds to relative-urls.)

@jhnns
Copy link
Contributor

jhnns commented Jul 18, 2018

Looks good to me 👍 :)

@matthew-dean
Copy link
Member Author

Thanks @jhnns!

@matthew-dean matthew-dean merged commit 2d43c0b into master Jul 18, 2018
@matthew-dean
Copy link
Member Author

@jhnns Would you be willing to write up documentation in a pull request for https://github.com/less/less-docs? You can see an example of option deprecation for the new math setting: http://lesscss.org/usage/#less-options-math

@jhnns
Copy link
Contributor

jhnns commented Sep 30, 2018

Sure, I can do that :)

jhnns added a commit to jhnns/less-docs that referenced this pull request Sep 30, 2018
@jhnns
Copy link
Contributor

jhnns commented Sep 30, 2018

@iChenLei iChenLei deleted the feature/rewrite-urls branch July 20, 2021 03:56
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.

3 participants