EDIT - By using SvelteKit starter app from here and applying tailwindcss as a adder by
following steps through this
repo I was able to
compile the svelte-app with tailwindcss utilities in real-time.
But would still like to know about the issue I mentioned below and a fix for it.
Trying to create a Svelte app and add Tailwind CSS Framework to it.
So as of now:
I have Installed the svelte app and added the Tailwind CSS and the other requirements based on this website and I am able to use Tailwind classes and utilities in my app.
Now the problem is even for such simple project the build time for the app is too high (~19s) which is not ideal to work with.
All other file configs and properties are default other than the changes mentioned in the link above to add tailwind to a svelte project.
<!--------- App.svelte --------->
...
<main>
<h1 class="text-purple-400">Hello World!</h1>
</main>
<style global lang="postcss">
#tailwind base;
#tailwind components;
#tailwind utilities;
...
</style>
############################ Terminal output ############################
bundles src/main.ts → public\build\bundle.js...
created public\build\bundle.js in 18.7s
[2021-11-25 20:10:38] waiting for changes...
[20:10:38] 200 ─ 0.87ms ─ /
[20:10:38] 200 ─ 1.29ms ─ /global.css
[20:10:38] 200 ─ 1.68ms ─ /build/bundle.js
[20:10:38] 200 ─ 2.82ms ─ /build/bundle.css
[20:10:38] 200 ─ 0.73ms ─ /favicon.png
So till now what I've tried and understood in that process:
This excessive build time is caused due to the fact that the Tailwind utilities.css file is rebuilt after every change made in <style> of the app. (And also since this is the biggest file in comparison with base.css components.css and hence takes more time)
One way to fix this issue is to separately import of these Tailwind files which would avoid the rebuilding of utilities.css whenever a style change is made in the app. (I am not clear how this would solve the problem)
I read through many GitHub discussions related to this but I still was not able to fix my issue or wrap my mind around that how importing the files separately is making a difference?
So my final question is:
What is the way to fix this problem (reduce the build-time when using Tailwind) and how is that fix solving the problem?
Thank you in advance :).
P.S. - This is my first question here so sorry for any mistakes.
I'm also facing the same issue. For me https://github.com/svelte-add/svelte-add worked fine. You can add tailwind and postcss using the below commands
npx svelte-add postcss
npx svelte-add tailwindcss
**Edit 1 :- ** You can also set the purge option in tailwind.config.js option to one of the below values and it will also speed up your build time.
purge:{
enabled: true
}
or
const production = !process.env.ROLLUP_WATCH;
purge:{
enabled: production
}
Related
I'm migrating from my Vue 2 / Webpack 4 setup to Vue 3 / Webpack 5.
Here's my boilerplate code on GitHub, so far. It's a VS.NET project, making use of NPM Task Runner to watch and auto-transpile my vue files.
It works for the most part, save for the fact that the CSS isn't properly scoped. It does scope the injected CSS (with attributes such as 'data-v-37bfa8da'), but it doesn't apply this scoping to the HTML elements.
Ergo, the CSS isn't applied at all.
It does get applied when I leave out the 'scoped' attribute in my .vue file's CSS. But then my CSS is global: not scoped at all. But on production, you really do need automated CSS scoping.
I've tried the most often suggested fixes on SO (link 1, link 2), but nothing works:
set esModule to false in css-loader
replace vue-style-loader by style-loader
add '*.vue' to the sideEffects prop in package.json
The first suggestion is currently applied in the GitHub repo's source. The others are not.
Another person, outside of SO, showed me a working setup where he used esbuild-loader. I tried this. Also doesn't work for me.
All packages are up to date. So is my NodeJS.
I don't have so much experience with Webpack. It could be any setting in any package. I could be searching for an answer for a long time.
Is there anybody on here more experienced in Webpack, who is able to find a solution to my problem more quickly?
The fix is to add Vue as an external to webpack.config.js.
externals: {
vue: 'Vue'
}
So I'm a newbie trying to learn SASS/SCSS/Bootstrap. I'm working on VSCode and installed SASS and bootstrap via npm in the terminal. All was well and I was working on this particular project for a few days until SASS stopped compiling out of the blue. I noticed that if I make changes to my main style.css sheet it will be reflected in the browser, however any changes to the scss partials and it's not compiling to the main style.css sheet.
To complicate things further, I was on the package.json file and clicked on 'Debug' where it made it worse - now there's no styling at all. The style.css sheet somehow consists of
#use "custom";
#use components/buttons;
etc etc..
and
#use sections/navbar
#sections/intro-section
etc etc...
The Live Sass Compiler is working and is 'watching'.
I have Live Sass Compiler and Live Server installed as extensions. I'd appreciate any help as I was stuck on this the whole day!
I'm new here so I wasn't allowed to upload images directly.
screenshot 1
screenshot 2
screenshot 3
Are you compiling on your local machine with VSCode using LiveSassCompiler by Glenn Marks (glenn2223.live-sass)? If you are using ritwickdey.live-sass, try swapping it for Glenn's as the latter is no longer maintained I think. Then, try appending a .bak to the style.css and style.css.map to regenerate the CSS with the compiler.
I updated my project from NG7 to NG9.
While i was in NG7 i used to load themes (i have a global styles.scss and inside themes i have different
colors to overide), dynamically when my app was served by using the style-loader like this:
require('style-loader!./../cssThemes/' + environment.MY_CUSTOM_THEME); (where environment.MY_CUSTOM_THEME is the name of theme.scss) and then the style-loader, load my custom theme on a <style> tag inside <head> tag.
Now that i am in NG9 (9.0.4) (typescript 3.7.5), this functionality stopped working.
Does anyone has the same problem? OR maybe has a different solution to provide?
Stackblitz instance: https://stackblitz.com/edit/angular-zkc9yt
I found what was the problem. When i updated my project through angular cli, the dependencies of style-loader and css-loader was not updated. As a result these dependencies did not work properly (posibbly of the node version , i was in node 7.X and upgraded to 13.X). So i updated them and the problem is now fixed.
Enviroment
I have an extjs 6 application which is already compiled and the css files like they should be. This application wasn't compiled for a while and now it's generating a different (wrong) css file. Since someone else changed the app, I have no clue what has changed since the last compilation. I compile with sencha app build development and the following CSS files change:
build\development\MyApp\classic\resources\MyApp-all_1.css
build\development\MyApp\classic\resources\MyApp-all_2.css
There are a few more files in the folder which do not change.
Versions:
Sencha Cmd 6.1.3.42
SDK Version (if neccessary) 6.0.2.407
Problem
I want to generate the same css like before. It seems there are just a few files which are not included within the compilation process, like:
ext/classic/theme-base/sass/etc/mixins/frame.scss
ext/classic/theme-base/sass/etc/mixins/slicer.scss
ext/classic/theme-neutral/sass/src/tab/Tab.scss
Question
What do I have to do, to get the old css? Is there some file with includes? Like classic\sass\src\view\main\Main.scss or something? I guess those includes are somewhere (since it already worked at least once) and maybe commented out or something.
What I've already tried
I tried to compile with different themes refered by the app.json attribute was builds->theme. I also tried a lot of playing around stuff, which I can't describe here in detail.
Any advice would be greatly appreciated!
Thanks in advance!
If you have any questions leave a comment and I'll try to add it to my text!
I am reasonably new to Grunt - I have less setup via grunt/node and would like to include the basic unstyled responsive backbone of Bootstrap - rather than the entire css/ js - is this possible - can anyone explain how as i've read various documentation and i'm mighty confused!
I have found this NPM library - https://www.npmjs.com/package/grunt-bootstrap which sound slike it could provide what i'm after but I have no idea what files would provide me with the basic responsive skeleton without all the styling - or what version of Boostrap the files relate to - can anyone advise please?
You can download the Bootstrap's source code. Then run npm install, after that you can rebuild bootstrap by running the Grunt tasks.
You can disable the jquery Plugins in the Gruntfile.js by commenting them out. The same for your CSS code in the less/bootstrap.less file.
The less/bootstrap.less file already contains useful comments such as // Reset and dependencies and // Core CSS so it will be easier to find out what to use and what not.
To compile a very basic version that only contains the grid system you could use a less/bootstrap.less which contains:
// Core variables and mixins
#import "variables.less";
#import "mixins.less";
// Reset and dependencies
#import "normalize.less";
#import "print.less";
// Core CSS
#import "grid.less";
After changing the less/bootstrap.less as above you can run grunt dist-css. The preceding command compiles dist/css/bootstrap.min.css which can be used for your project.