Comments (4)
Thanks a lot, Waldek!
from sp-dev-fx-webparts.
Is it possible to create a custom CSS file in the src folder and use it across the Web Part? For example, creating a standard set of Angular views and styling the HTML with that CSS?
Yes, you can include a regular .css file in your project and then in your code use require('./myfile.css')
to load it inline in your web part. That way its contents would be embedded in the web part though so if you have multiple web parts and would like them to reuse the same CSS it might not be the perfect solution.
Is there any way of removing those suffixes?
Yes, you can wrap your classes in :global { ... }
, like:
:global {
.myclass {
}
}
Everything inside :global
will be left without suffix. Please note that it has the risk of conflicts of your classes with other classes that might be on the page. A thing that you could perhaps try would be to use the following construct:
.myWebPart {
:global {
.myClass {
}
}
}
On the top element of your web part you would use ${styles.myWebPart}. In your Angular template you would use regular CSS classes without any suffix. The difference in this approach is that the generated CSS would be like .myWebPart_5944ac05 .myClass
which helps you isolate your styles from other styles available on the page.
from sp-dev-fx-webparts.
For your 'resx-strings' error, please check sp-module-loader loadCss broken in Drop 6 #286 . you need to add "@microsoft/sp-module-loader": "node_modules/@microsoft/sp-module-loader/dist/sp-module-loader.js",
in your config.json if you need to use LoadCss().
from sp-dev-fx-webparts.
Thx much!
from sp-dev-fx-webparts.
Related Issues (20)
- react-utility-extensions - Question about Package Availability HOT 3
- How to Hide Event Owner Initials HOT 2
- Localize datepicker with react-rhythm-of-business-calendar HOT 5
- Localize date picker HOT 4
- react-calendar - Recurring events nolonger showing on the calendar HOT 1
- react-msgraph-peoplesearch - HOT 2
- react-news-extension - Missing metadata tags HOT 4
- Filter users based on AD attribute HOT 2
- react-caml2table doesn't build HOT 6
- react-birthdays - HOT 1
- react-script-editor - not working HOT 1
- react-script-editor-onprem - gulp serve throws Unexpected reserved word error HOT 8
- js-advanced-commenting - HOT 1
- Solution stopped working after reaching 5k items HOT 3
- REACT-ACCORDION - HOT 2
- react-fluentui-9 - SPFx 1.18 compatibility with react 17 and Fluent 2 (v9) -> console errors. HOT 3
- react-personal-tools-list - Enhanced web part properties to setup the designated lists (architecture extension) HOT 3
- react-myonedrive - HOT 4
- react-directory - Hide hidden users HOT 3
- The Advanced Comments Box solution did not work for the users with the read access. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sp-dev-fx-webparts.