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

Generating multiple style files #2722

Closed
vlio20 opened this issue Oct 15, 2016 · 5 comments
Closed

Generating multiple style files #2722

vlio20 opened this issue Oct 15, 2016 · 5 comments

Comments

@vlio20
Copy link

vlio20 commented Oct 15, 2016

Hi,
Is there a way to generate multiple style files (during build process)?
It is required when the cli used to build a 3rd party component (for example - date picker).

Currently I see that there is only one file generated after ng build --prod- styles.js.

Thanks!

@Meligy
Copy link
Contributor

Meligy commented Oct 16, 2016

If all you want is include the files, then you can use the styles property in angular-cli.json.

You can either add the file there, or open the default styles.css or styles.scss and add a CSS import to the styles file, Webpack will bundle that (not leave it to the browser).

If you really need a certain path to be included, the AngularCLI now allows you to pass an array to the assets property. The files and folders matching each string in this array, get copied as-is to the output folder (dist by default).

However, it's worth mentioning that this change (de3c275) is very new and is not yet included in beta-17. So your options today are:

  • Check if the CSS import thing works. Most likely it will
  • Use linked CLI cloned from github source (has some complexities)
  • If you can have the path under assets, current assets property behaviour is to copy src/assets as-is to output folder (dist). When the property changes from string to array, the team still included the old string in it, so this will NOT break when you upgrade the CLI

That said, I do not think there is any particular feature to be requested other than what's already on Github. If you agree, you may want to close the issue to give the team less stuff to worry about.

Cheers,

@vlio20
Copy link
Author

vlio20 commented Oct 16, 2016

thanks @Meligy, basically I am trying to build a small library and it seems that the cli wasn't planed for this case. The issue above and also the inability to build unbundled items with the cli are closing the story of building libraries with the cli. Am I right?

@Meligy
Copy link
Contributor

Meligy commented Oct 16, 2016

I think if you are creating a library you would still be able to bundle stuff into it. Webpack supports this scenario, and has some metadata json file or something to make it nicer etc.

And again, if you want files unbundled, as-is, just put them in the assets folder.

However, I'll answer the more important question: Is the Angular CLI built for the "Library" use case?

I can't find the docs backing my words at the moment, but yes, generating libraries is out of the short term scope for the Angular CLI, although it's something the guys want to have in the long term (my person expectation is: "Library" story is not coming any time soon, just by looking at amount of work left for "Application" story).

Of course you might want to offer to help with that, but that's a different conversation.

@vlio20
Copy link
Author

vlio20 commented Oct 16, 2016

thanks @Meligy

@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 Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants