Skip to content

feat: allow data to be prepended via options.prependData#327

Merged
alexander-akait merged 2 commits intomasterfrom
prepend-data-option
Mar 16, 2020
Merged

feat: allow data to be prepended via options.prependData#327
alexander-akait merged 2 commits intomasterfrom
prepend-data-option

Conversation

@ryanclark
Copy link
Copy Markdown
Contributor

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

Add the prependData option that sass-loader offers

@ryanclark ryanclark force-pushed the prepend-data-option branch from db6fbdd to c54a57f Compare March 16, 2020 16:08
const lessOptions = getLessOptions(this, options, source);

processResult(this, render(source, lessOptions), callback);
processResult(this, render(lessOptions.data, lessOptions), callback);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was considering having getLessOptions return an object of {lessOptions, data} so we wouldn't pollute the lessOptions with data - can change if needed

README.md Outdated
const { resourcePath, rootContext } = loaderContext;
const relativePath = path.relative(rootContext, resourcePath);

if (relativePath === 'styles/foo.scss') {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

scss -> less

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops, good catch, fixed

Copy link
Copy Markdown
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

One typo 😄

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.

2 participants