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

Make compilerHost.readResource injectable, so scss preprocess is possible via the API #25382

Closed
wants to merge 1 commit into from

Conversation

alippai
Copy link
Contributor

@alippai alippai commented Aug 8, 2018

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Feature

What is the current behavior?

It's not possible to preprocess the loaded resources during compilation.

What is the new behavior?

This PR adds an option to process scss files and inject the desired css (using the the API), so there is no need for extra watch step and temporary files.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Example usage:

main(['-p', './src/tsconfig.json'], undefined, path => {
  if (path.endsWith('.scss')) {
    const result = node_sass.renderSync({
      file: path,
      outputStyle: 'compressed',
      sourceMap: false,
    });
    return postcss([autoprefixer]).process(result.css.toString('utf8'), { from: undefined }).css;
  }
  return fs.readFileSync(path).toString('utf8');
});

@kara kara added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime target: major This PR is targeted for the next major release feature Issue that requests a new feature labels Oct 11, 2018
@alippai
Copy link
Contributor Author

alippai commented Oct 13, 2018

Thanks @kara!

@alexeagle
Copy link
Contributor

It's part of the old compiler, which we are rewriting for Ivy right now, so it's a hard time to accept changes here.
Can you explain what's your use case for writing a custom Angular compiler? We don't want to fragment the ecosystem by having some compiler with additional semantics that aren't in the ngc program

@alippai
Copy link
Contributor Author

alippai commented Jan 18, 2019

Maybe there is no need today. Back then it was really easy to call ngc watch + rollup watch from a single script, also made this 10 line patch to support scss. It was really fast, incremental "natively" (both ngc and rollup was nice, had only a few bugs). The build chain is custom anyways (web workers, custom loaders, multiple targets like ES5/6/8 in parallel)

@alippai
Copy link
Contributor Author

alippai commented Jan 18, 2019

Also the integrated ngc+scss compile ensured the only one watch is triggered. There was no timing weirdness which we had with separate scss watch + ngc watch.

@ngbot ngbot bot added this to the needsTriage milestone Jan 24, 2019
@AndrewKushnir
Copy link
Contributor

Closing this PR since it affects ViewEngine, which is now deprecated. Thank you.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime cla: yes feature Issue that requests a new feature target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants