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 content query online HOT 1
- react-fluentui-9 - Styles in Menu/Popovers missing HOT 1
- Custom webpart icons not clearly visible in full-width section
- react-accordion-with-richtext - "something went wrong" tinymce error on mobile
- react-kanban-board - Error: Cannot find module 'node:os' HOT 4
- Custom layout template hangs page and never loads entries
- react-script-editor: Your dev environment is running NodeJS version v20.10.0 which does not meet the requirements for running this tool. HOT 1
- react-list-search - HOT 1
- js-advanced-commenting ping user notification? HOT 1
- react-modern-version-history - How to set up and make it work.
- react-calendar - why really slow when first opening a page with this webpart on it? HOT 1
- react-birthdays - HOT 2
- Script editor web part for modern pages stopped working HOT 6
- error while running the webpart
- react-calendar - HOT 1
- Twitter feed not appearing on React Twitter webpart after configuring profile.
- Issue with calendar category component to filter.
- Calendar webpart - Facing issue while creating weekly recurrence event
- react-script-editor - HOT 4
- react-script-editor - cannot add two body HOT 1
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.