Skip to content
This repository was archived by the owner on May 8, 2021. It is now read-only.

Add Angular #35

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Add Angular #35

wants to merge 9 commits into from

Conversation

tunecino
Copy link

No description provided.

Finally, add this to `src/styles.css`:

```scss
@import "tailwindcss/base";
Copy link

Choose a reason for hiding this comment

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

Can't this be using @tailwind ?

Suggested change
@import "tailwindcss/base";
@tailwind"tailwindcss/base";

Copy link
Author

@tunecino tunecino Sep 17, 2019

Choose a reason for hiding this comment

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

Any particular reason/benefit for this change? I've understood from documentation that @import is the right way. But not really sure how angular handles it.

If you're using postcss-import (or a tool that uses it under the hood, such as Webpacker for Rails), use our imports instead of the @tailwind directive to avoid issues when importing any of your own additional files

(PS: I think you mean @tailwind base;)

Copy link

Choose a reason for hiding this comment

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

Yes, I mean @tailwind base; I think the difference is in the fact I'm not using postcss-import in my project. I followed the installation guide including the Webpack guide.

I have pushed my project for reference. Don't know what the best way to go is as I'm relatively new to TailwindCSS and PostCSS. Maybe @adamwathan can give some advice here

@DeluxZ
Copy link

DeluxZ commented Sep 4, 2019

Nice! Just did this myself with Angular 8 before I saw your PR. Came down to the same thing actually 👍

@DeluxZ
Copy link

DeluxZ commented Sep 17, 2019

Ping @adamwathan @tunecino

Co-Authored-By: Harrie Essing <harrie.essing@gmail.com>
@marcjulian
Copy link

marcjulian commented Mar 20, 2020

Works also great with Angular 9 👍

@antonellopasella
Copy link

could we merge this PR?

npx tailwind init
```

Finally, add this to `src/styles.css`:
Copy link

Choose a reason for hiding this comment

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

Finally, add this to src/styles.css:

Should this not be .scss?

Copy link

@marcjulian marcjulian Jun 4, 2020

Choose a reason for hiding this comment

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

Depending on your stylesheet format you select for your Angular app - ng new APPNAME supports

  • CSS
  • SCSS
  • Sass
  • Less
  • Stylus

Choose a reason for hiding this comment

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

Maybe the explanation should include these as a clarification. Also, has anyone tested this method works the save on all of those (CSS, SCSS, Sass, Less, Stylus) by just adding the imports to the right styles.[extension] file, without changing any of the other steps?
If changes are required for some of the style versions we should mention it, or with any extra steps.
Or if some style is not supported we should also mention it.

Copy link

Choose a reason for hiding this comment

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

@marcjulian I was thinking more inline withe the context of the document, which references .scss everywhere else

Copy link
Author

Choose a reason for hiding this comment

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

Sorry for delay. @marcjulian is right you can use any of those but this working example is about scss as it starts with ng new angular-cli --style=scss. So yes @blowsie it is a typo that I fixed in a later commit back in september (8c7902a).

@pablokvitca
Copy link

Should this also update the setup-examples/README.md to mention the example for Angular?

@KingDarBoja
Copy link

Keep in mind that Angular is already at v10 but the config setup still applies :)


### TailwindCSS as a separate Design System Project

This is more of a recommandation for advanced projects.
Copy link

Choose a reason for hiding this comment

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

Typo, please replace with "recommendation".

Copy link
Author

Choose a reason for hiding this comment

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

Thank you @royvanv.

Copy link

Choose a reason for hiding this comment

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

No problem!

}
```

Make those changes for both **architect.build** and **architect.serve**.
Copy link

Choose a reason for hiding this comment

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

Perhaps move this notice up? Seems kind of important.

@royvanv
Copy link

royvanv commented Jul 20, 2020

This works for Angular 10, using version 10.0.0-beta.1 10.0.0 of @angular-builders/custom-webpack.

Edit: v10.0.0 was just released.

@tunecino tunecino changed the title Add Angular 8 Add Angular Jul 23, 2020
@KingDarBoja
Copy link

Quick notice: There is a package that helps setting up Tailwind + Angular very quickly called ng-tailwind. Would be good to put a note about it at the start :)

@daboudii
Copy link

daboudii commented Sep 14, 2020

Quick notice: There is a package that helps setting up Tailwind + Angular very quickly called ng-tailwind. Would be good to put a note about it at the start :)

⚠️ WARNING

you should use this Schematics https://github.com/ngneat/tailwind. Up to date with the latest postcss-loader (v4.x.x)

or add postcssOptions in webpack.config.js

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants