wordpress SASS compiles but background images don't display - laravel

I am using Laravel mix and webpack.mix.js to compile css in wordpress. I've set up the source files and am able to compile without errors using npx mix watch etc in visual studios, creating the app.css and app.js files in the dist folder.
let mix = require('laravel-mix');
mix
.js('src/app.js', 'dist')
.sass('src/app.scss', 'dist');
However, when I tried to add an image in one of the pages via the respective scss file,
#hero {
height: 550px;
width: 100%;
background: url(/images/water.jpg) #f0f0f0;
}
the files compile and the css is the same in the compiled app.css file, but the image is not visible on the page or in the inspection bar.
I've tried every variation for the image path, including adding ../ or ./ in front, but most just give an error.
I've tried to override with option processCssUrls to the webpack.mix.js
let mix = require('laravel-mix');
mix.options({
processCssUrls: false
})
.js('src/app.js', 'dist')
.sass('src/app.scss', 'dist');
but this doesn't seem to do anything, although it's possible I added it wrong.
Strangely, the file also doesn't properly compile any of the custom colours that I make. I made a _colour.scss file in the source file with
$light: rgba(13, 59, 21, 0.6);
$dark: rgb(131, 56, 56);
and imported in the main scss file, but sometimes when I use it for links or backgrounds, it defaults to a different colour, even the !important tag doesn't help. The compiled css file also just shows different colours,
in the _header.scss file:
a {
display: block;
padding: .25rem 1rem;
color: $dark!important;
font-size: 1.1rem;
text-decoration: none;
}
a:hover {
text-decoration: underline;
color: $light!important;
}
and in the compiled app.css file:
header .top-menu li a {
display: block;
padding: 0.25rem 1rem;
color: #212529 !important;
font-size: 1.1rem;
text-decoration: none;
}
header .top-menu li a:hover {
text-decoration: underline;
color: #f8f9fa !important;
}
so perhaps something is going wrong in the compiling

Related

Font-Awesome Showing FL as icon with SASS

Using Font-Awesome 5 and following the usage docs on their website I set up a little .scss test. The problem I am running into is that the icon (which should show a magnifying glass) show "fl" instead.
#import "./scss/fontawesome.scss";
#import "./scss/fa-solid.scss";
.test{
width: 200px;
height: 200px;
background: purple;
}
.test:before{
#include fa-icon;
#extend .fab;
content: fa-content($fa-var-search);
font-size: 24px;
color: #FFF;
}
Verified the _variables.scss is pointing to the proper web folder and that the resources are loading.
Any help would greatly be apppreciated.

How to get proper indentation from sass to css?

I am a new sass user. when i am typing in style.scss and it converted to style.css, the stylesheet indentations is too poor. The style.css did not get the proper indentation.
I am using c9.io here is the screenshot of my style.scss and style.css
Thank You
Sass has a few output styles. It sounds like you're looking for the "expanded" style.
nested
#main {
color: #fff;
background-color: #000; }
#main p {
width: 10em; }
expanded
#main {
color: #fff;
background-color: #000;
}
#main p {
width: 10em;
}
compact
#main { color: #fff; background-color: #000; }
#main p { width: 10em; }
compressed
#main{color:#fff;background-color:#000}#main p{width:10em}.huge{font-size:10em;font-weight:bold;text-decoration:underline}
I'm not familiar with the c9 editor but if there's a settings page (maybe try the cog icon in the bottom right of the editor), you may be able to toggle it there.

Barryvdh/laravel-dom-pdf Issues with html entities and random CSS

I am using this excellent package: https://github.com/barryvdh/laravel-dompdf
To download a view to a customers computer.
$pdf = PDF::loadView('doc_generation.mot', ['car' => $car]);
return $pdf->download($vrm .' MS.pdf');
Everything works fine, but no html entities are being shown on the pdf. Have tried the tick itself, and ✔ but both don't show.
I also have a div:
.number-plate {
background: #FFD307;
padding: 16px;
border: 1px solid #999;
font-size: 36px;
font-weight: 700;
border-radius: 5px;
}
Where the padding isn't shown on the output PDF. Although padding used elsewhere on other selectors is fine.
Anyone know how to fix these issues?

Changing mixins.scss does not change the CSS files importing it

Here is what we are doing:
we are creating a hook to modify the \html\css\common\_mixins.scss file.
The file when deployed is updated. So far so good.
The problem is the CSS files which are importing this mixin are not showing any changes, for example this file - \webapps\ROOT\html\css\taglib\navbar.css.
After some debugging I found that there is a .sass-cache folder in \webapps\ROOT\html\css\taglib\.sass-cache which also has the final generated file navbar.css which is used by the portal.
Now when I deploy the hook all the CSS files which import this mixin are not recompiled/regenerated in .sass-cache folder, which makes the hook useless.
Can somebody tell me if there is any way to make use of this mixin or is there anyother way to do this or may be I can manually recompile all the CSS files using this mixins if only I knew how to.
Also I see that deleting the .sass-cache is not an option since this folder is also used by liferay to patch CSS files if there is a hot-fix.
Environment
Liferay EE 6.2 SP9 bundled with Tomcat
Reason from the comments
The reason why we need to change this file is to have a way to disable responsive elements for the navigation-bar. Or better still disable responsiveness for the whole portal. Since the responsiveness is due to the media-query.
Thanks
It's not possible to alter _mixins.scss via hook, and it's not only due to the evil sass-cache.
_mixins.scss is written is SASS and it needs to be compile and store in sass-cache. Every theme includes compiled version of every sass file.
The only way is to build you own theme and change _mixins.scss or any other file in _diff folder.
Why do you need to alter that particular file?
So the changes were not reflected and I think CSS is not meant for hooking.
So after trying a lot of stuff, still we were not able to disable responsiveness, so we applied the following CSS in our custom.css in our theme. This worked for the navigation bar, for others we can again include those styles individually.
#media (max-width: 979px) {
.navbar .container {
position: initial;
}
.navbar .container .btn-navbar {
color: initial;
display: none;
margin-bottom: initial;
width: initial;
}
.navbar .container .btn-navbar > .icon-bar:first-child {
margin-top: initial;
}
.navbar .container .btn-navbar > .icon-bar:last-child {
margin-bottom: initial;
}
.navbar .container .nav-collapse {
display: initial;
}
.navbar .container .nav-collapse.open {
display: initial;
height: initial;
overflow: initial;
}
.navbar .container .nav-collapse .btn {
padding: initial;
}
.navbar .container .navbar-search {
margin: initial;
padding: initial;
}
.navbar .container .navbar-search .btn,
.navbar .container .navbar-search .btn-link {
clip: none;
position: initial;
}
.navbar .container .navbar-search .form-search {
margin: initial;
}
.navbar .container .navbar-search .form-search .input-append {
display: initial;
padding-right: initial;
}
.navbar .container .navbar-search .form-search .input-append .search-query {
width: initial;
}
}
This CSS code is taken from this Liferay forum post.

Overlap div past container with clearfix mixen overflow:hidden

I've recently updated to SingularityGS 1.4.0 and have run into an issue with my .container class using an #include clearfix; which now includes an overflow:hidden property.
For a slideshow component, I use negative/positive margins to display arrows overlapping arrows outside of the .container:
.container { //Container for the grid system
background: $background-color;
max-width: $site-width;
margin: 0 auto;
position: relative;
#include clearfix;
#include breakpoint($large-break) {
border-left: 20px solid #fff;
border-right: 20px solid #fff;
width: $site-width;
}
.container {
border: 0px;
margin: 0px;
clear: both;
}
}
.left-arrow, .right-arrow {
position: absolute;
cursor: pointer;
margin-top: -20px;
font-size: 0.8em;
width: 41px;
height: 41px;
top: 50%;
}
.left-arrow {
left: -10px;
background: url(/images/icons.png) no-repeat -153px -146px;
}
.right-arrow {
right: -10px;
background: url(/images/icons.png) no-repeat -197px -146px;
}
Here's a screenshot of the problem:
https://www.dropbox.com/s/yl4ch4yowe61kz7/Screenshot%202014-09-03%2010.06.50.png?dl=0
Should I be using something other then the clearfix mixin in my container?
Edit: - Added Sassmeister issue as requested
This version of Singularity uses the Compass clearfix. You can write your own to work as you want it:
#mixin clearfix {
&:after {
content: '';
display: table;
}
}
see: http://sassmeister.com/gist/099ef72b56365fe8ce07
Singularity doesn't have its own clearfix mixin.
You're using the clearfix mixin from Compass which leverages the overflow: hidden technhique which in turn crops your container.
The solution is to use another mixin for clearfixing.
Compass bundles three different clearfix mixins, the most usable of which is the pie-clearfix. It's output is as follows:
.foo {
*zoom: 1;
}
.foo:after {
content: "";
display: table;
clear: both;
}
I recommend that you use the clearfix mixin bundled with the beautiful toolkit Sass extension by Team Sass.
It has the following benefits over the pie-clearfix:
Shorter output that works for all modern browsers:
.foo:after {
content: "";
display: table;
clear: both;
}
Two ways of applying: the traditional mixin way (default) and the extend way. The extend way makes your CSS footprint even smaller by deduplication. The downside of the extend way is not being able to apply it from media queries, though i've never faced a situation where you would need a clearfix only in a media query and need it not to be applied outside media query.
To configure Toolkit for using the extend way apply this in the beginning of your CSS:
#include toolkit-set('clearfix extend', false);
To override current setting once use this:
#include clearfix(true);
true means the extend methhod, false means the mixin method.
Note that if you're including both Compass and Toolkit, Toolkit should come after Compass to override the clearfix mixin.
If you feel that Toolkit is too bulky for your project, simply define your own clearfix mixin after importing Compass, just like Scott suggests. Just be sure to use proper clearfix method, Scott's code (as of 2014-09-04 12:00 UTC) doesn't actually clearfix.

Resources