Open bornResponsive opened 3 years ago
On rule 7
of vue.config.js
, the extract
of css is disabled, therefore the css is included inside the javascript and always loaded inside a <style>
tag inside the html. - https://github.com/nathanreyes/v-calendar/blob/master/vue.config.js#L7.
We also have problems with this, because of the inline style, our CSP rules will not load the styles. - https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
If we change rule 7 to true
, we will get an external css file, but this will be a breaking change, because everyone needs to load the css by them self.
Hi Jan. Thanks for the feedback.
So just by changing line 7 to true, TailwindCSS will be disabled for the NPM installation?
I think it will be great if V-Calendar offered 2 option for CDN - one with TailwindCSS and the other barebone just with flexbox/grid layout style.
Hi Tuguldur,
Yes, then the lib
folder contains a separate css file, if you don't import that file inside you project, the calendar has no styles. But this must be implemented though an pull request or change from @nathanreyes and will break the default working of the package.
@nathanreyes If you need help, let me know. At the moment our release is depending on this change.
Just a couple of notes.
For 2.0 and later, the use of Tailwind classes has been dropped to trim the package size (even with PurgeCSS used). While PurgeCSS theoretically should have taken care of this, many classes needed to be whitelisted in order to support all the supported theme colors. Using CSS variables just made everything simpler using a more conventional CSS approach. As a result, it should also help to more easily override class styles.
All sections of the calendar have had classes applied in the form of vc-pane
, vc-title
, vc-weeks
, vc-weekday
, etc. that you can target.
In know that doesn't directly address the question posed, but it is one option to consider.
@janvanhelvoort Regarding extracted styles, if we were to prevent a breaking change, one option might be to include a separate build in a nested package directory. For example, one would have to do something like npm i -S v-calendar/with-css
or something like that.
I hesitate to break the current default workflow. Version 3.0 is currently being used for Vue 3 support (which could be adjusted to use this extracted style approach), but if I incorporate this in a minor release (2.x) then I could see lots of people being upset when they upgrade.
I'm definitely open to options though.
@nathanreyes. Thank you for the response. I won't suggest to change it in a minor release, but if we can supply 2 more files inside the output directory, highlighted in the screenshot above, it would be great.
Because of the css, which is inside the v-calandar.umd
file, webpack won't/doesn't extract that css into our own css bundles. therefore the umd
file will inject the css as inline style tags in the header.
If we can find a solution where we have a umd file without css inside it, and a separated css file, we can import that css into our bundle.
I think this CSS change (dropping Tailwind and the new vc-
prefixed classes) should also be documented somewhere 🙏 The theming guide is very outdated - https://vcalendar.io/api/v2.0/theme-styles.html
Spent a huge amount of time (studied examples, Issues, tried everything written in the documentation), but to no avail. I could not connect the css to the calendar. As a result, it works as it should, but it looks ugly and not like on your example page.
I cannot repeat as written in the example <Calendar class = "custom-calendar max-w-full" ...
(https://vcalendar.io/ Custom Calendars - Roll your own calendars using scoped slots https://github.com/nathanreyes/v -calendar / blob / master / docs / .vuepress / components / homepage / custom-calendar.vue)
Please tell me how to properly connect the css to my project. This is probably a small fix, but I can't do it without help.
I have attached a file what my calendar looks like
@nathanreyes. Thank you for the response. I won't suggest to change it in a minor release, but if we can supply 2 more files inside the output directory, highlighted in the screenshot above, it would be great.
Because of the css, which is inside the
v-calandar.umd
file, webpack won't/doesn't extract that css into our own css bundles. therefore theumd
file will inject the css as inline style tags in the header.If we can find a solution where we have a umd file without css inside it, and a separated css file, we can import that css into our bundle.
I was wondering if there was any progress on this? I too am blocked by the injected styles not complying with __webpack_nonce__
.
I think including a "standalone" or "minimal" module sperate form the bundled one alongside a CSS file would be a simple way to allow for CSP compliance.
I'd also be interested in seeing an option to disable all styles and have the ability to import the CSS into my existing build tools.
I'm using the vuejs v3 version.
On rule
7
ofvue.config.js
, theextract
of css is disabled, therefore the css is included inside the javascript and always loaded inside a<style>
tag inside the html. - https://github.com/nathanreyes/v-calendar/blob/master/vue.config.js#L7.We also have problems with this, because of the inline style, our CSP rules will not load the styles. - https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
If we change rule 7 to
true
, we will get an external css file, but this will be a breaking change, because everyone needs to load the css by them self.
The "extract: false" rule breaks SSR as well (it is a known issue with Vue-cli). V-Calendar should provide 2 builds... one with this rule set true, one with it set to false.
The version with it set true would just need to indicate in the docs a new import path as well as instructions to include the generated CSS file.
A process.env variable could be used to toggle the setting at build time. Other than that, this would just require a slight change to the package.json file to indicate the path to the version with "extract: true".
Doing it like this would prevent the "breaking change" issue. Honestly, the extracted CSS version should become the default in the future anyway due to these various issues.
One more thing to note, it would be beneficial to migrate to Vite as the development environment from Vue-cli. The benefits far outweigh any migration headaches.
Is there any configuration for disabling the default TailwindCSS and use your own custom stylesheet? The manual does not provide any information about this with NPM or CDN installation.
Help very much appreciated.