Skip to content

options version 3x #5

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

Merged
merged 3 commits into from
Dec 30, 2014
Merged

options version 3x #5

merged 3 commits into from
Dec 30, 2014

Conversation

bassjobsen
Copy link
Contributor

As far as i understand the option should be changed according https://github.com/jakubpawlowicz/clean-css#how-to-upgrade-clean-css-from-2x-to-3x

Both advanced and rebase are set to false by default now.

options.noRebase = true;
if (options.noAdvanced === undefined) {
options.noAdvanced = true;

Copy link
Member

Choose a reason for hiding this comment

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

Btw. can't we just remove these conditions at all? Obviously undefined is already false by default.

@bassjobsen
Copy link
Contributor Author

Well clean css sets advanced and rebase to true by default, so we have to set it explicit to false on undefined. And yes indeed the --skip..... option do make any sense now and can be replace by the advanced and rebase options

@seven-phases-max
Copy link
Member

Well clean css sets advanced and rebase to true by default,

Ah, indeed - my bad (what a mess! :). OK, then can we simply put plugin's default values there, e.g. just:

options = {
   advanced: false,
   rebase:   false
};

Probably it's already getting a bit prose but would not it be more straight-forward to keep all this in one place? (I.e. why to bother fiddling with options in clean-css-processor.js itself?)

`

@seven-phases-max
Copy link
Member

OK, then can we simply put plugin's default values [there]

Ah, never mind I can see it won't be correct (since plugin can be created w/o options passed in). OK, then it's OK as you wrote it

(Probably I need to experiment with creating similar plugins myself to see if such things can be simplified - having 4 files and 3 points of options modification seems to be quite an overkill for a plugin that simply copies a few values from one place to another :).

@lukeapage
Copy link
Member

The plugin parses the command line options to cleancss, which when i
checked are unchanged.. so although programmatically noAdvanced changed to
advanced, the command line still defsults to true doesnt it? And thats what
we are emulating?

@lukeapage
Copy link
Member

Yes just checked and the command line is unchanged from v2 to v3.

So when the plugin parses a string, we are calling from lessc and should
emulate clean css command line options. When plugin is programmatic e.g. in
grunt, you pass an object that is unchanged and matches the programmatic
interface.

@bassjobsen
Copy link
Contributor Author

Well i see now. Excuse me for the misunderstanding.

@lukeapage
Copy link
Member

No worries.

@bassjobsen
Copy link
Contributor Author

But........ with foo.less:

.foo {
  background-size: 200px; //for old browsers
  background-size: cover;
}

Both lessc foo.less --clean-css and lessc foo.less --clean-css="advanced=true" give me:

.foo{background-size:cover}

Where i expect that lessc foo.less --clean-css outputs:

.foo{background-size:200px;background-size:cover}

@lukeapage
Copy link
Member

I think i may have intended to change to the same defaults as clean css but
not updated the documentation. Im open to opinion/prs to fix documentation
or change code to default advanced to false again.

@lukeapage
Copy link
Member

Okay, now i see your changes and the code (im just on a mobile) i see your changes are all good apart from the changes to parse options - unless clean css dont call it skip rebase on the command line.

@bassjobsen
Copy link
Contributor Author

I think clean css calls it skip rebase, but you set rebase to false by default. Which makes that you should set skip-rebase makes no sense. But how to call the option to turn rebasing on?

@lukeapage
Copy link
Member

Ha, yes. Id say we need both options for compatability.

@bassjobsen
Copy link
Contributor Author

My PR has both options (turned to false by default). To turn them on you should set advanced and /pr rebase.

@lukeapage
Copy link
Member

I meant rebased and skip-rebase..

lukeapage added a commit that referenced this pull request Dec 30, 2014
@lukeapage lukeapage merged commit 63a5dc7 into less:master Dec 30, 2014
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