What is the ~ operator used for on a scss file? - sass

I do not understand the meaning of the ~ char in the following line of code in a scss file:
#import "~bootstrap/dist/css/bootstrap.min.css";

Since it's in the file path, I guess it's the "Bootstrap user home directory".
On Linux or Unix, home directories are named ~:
~ : the current user directory (yours)
~juan would be your home directory.
~bootstrap : bootstrap's user directory (ex: /home/bootstrap or maybe /usr/share/bootstrap or /opt/bootstrap)
More examples on https://askubuntu.com/questions/656869/how-does-using-the-tilde-work-as-a-shortcut-to-my-home-directory
So maybe your bootstrap files are located in a particular directory owned by a bootstrap user having that directory as his $HOME directory.
In that case, it's not at all related to Sass, it's only a regular file path.

That is not part of sass, it's actually a feature of sass-loader which you are probably using with webpack.
What it does is importing the file relative to the node_modules folder instead of the current file.
Check out sass-loader's documentation for more details: https://github.com/webpack-contrib/sass-loader#imports.

Related

Laravel App Not Loading CSS From Public Installation Not In public_html

I've installed a pre-made Laravel app and followed the documentation to extract it to the public root except in the documentation they are installing it into public_html, but I have it in a subdomain in a folder named "test" which is on the same level as public_html.
All the CSS and JS should be loading from the public subdirectory, but they try to look for it in the main root folder.
For example, this file returns a 404 error:
https://test.mydomain.com/css/style.css
The file is actually at this location:
https://test.mydomain.com/public/css/style.css
The absolute path of the file is:
/home/mydomain/test/public/css/style.css
Instead of:
/home/mydomain/public_html/public/css/style.css
What environment or config file isn't set correctly and how do I set it to use the correct directory?
UPDATE
Changing the ASSET_URL to "public" fixed the first issue, but now the same thing is happening with the admin.
The app tries to load the dashboard with this URL:
https://test.mydomain.com/admin/dashboard
The page loads all the assets normally when I remove the word "admin" from the URL:
https://test.mydomain.com/dashboard
But this doesn't work for all the pages.
You can try to put public directory path in below given conflagration file.
Config File Path : config/app.php (asset_url)
'asset_url' => env('ASSET_URL', 'https://test.mydomain.com/public/')

Having problems building github page(SCSS import fails (Jekyll))

I was trying to run a github page with Jekyll theme,and the website runs fine locally. However, when I try to urn in on htttps://username.github.io, GitHub cannot build the website.
I got the following error message :
Your site is having problems building: Your SCSS file myblog/assets/main.scss has an error on line 1: File to import not found or unreadable: minimaless.
The main.scss :
---
# Only the main Sass file needs front matter (the dashes are enough)
---
#import "minimaless";
It seems to be the path to the .scss file expected by GitHub is different from where the Jekyll theme put it. I checked some posts mentioned that I should put the absolute path of .scss in _config.yml file.
It seems to be the path to the .scss file expected by GitHub is different from where the Jekyll theme put it. I checked some posts link mentioned that I should put the absolute path of .scss in the directory of urlbase, which is /myblog. But I am not familiar with ruby, so I am not sure how should I do it.
The folder structure is like this :
myblog/
- assets/
- main.scss
- _sasss/
- minimaless.scss
- minimaless/
- basic.scss
- layout.scss
- hight-lighting.scss
- _config.yml
This is my GitHub page folder :
https://github.com/Po-Hsuan-Huang/Po-Hsuan-Huang-github.io
The issue could be because your source contents are within a subdirectory myblog. Try moving all the contents to the root of your repository.
It could also be because of the following in your config file:
theme: minimaless
#remote_theme: brettinternet/minimaless
theme: minimaless is not supported on GitHub Pages. Comment it out.
And finally, _site directory should not be checked into version control. Delete it from your repository and then add an entry for it in your .gitignore file.

My static files are not rending correctly

In my html page I am referencing static assets like:
<script src="/static/assets/js/bundle.js"></script>
and
<link rel="stylesheet" href="/static/assets/css/style.css">
These files are stored in:
/assets/js/bundle.js
/assets/css/style.css
Currently my route looks like this:
app.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("/assets"))))
Currently it is not working and returning a 404 not found error when I look at chrome console.
What am I doing wrong here?
The problem is with your call to http.Dir("/assets") in this line:
app.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("/assets"))))
http.Dir takes the path to the folder either in absolute form or relative to where the go executable is. Using "/assets" tells it that the absolute path to the assets folder is on the root of the file system, where in reality I'm guessing the assets folder is in something like /home/YOUR_USER_FOLDER/code/this_project/assets.
Just change the code to use the absolute path:
app.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("/home/YOUR_USER_FOLDER/code/this_project/assets"))))
If the assets folder is in the same location as the go executable, you can just use "assets" as the file path, but I will recommend using the absolute path to avoid any confusion.

Resolving asset location issue using Ruby SCSS transpiler in WebStorm

I have this structure of SCSS:
app
styles.scss
bower_components
_colors.scss
_fonts.scss
sass
index.scss
styles.scss:
#import "sass/index";
index.scss:
#import "bower_components/_colors";
#import "bower_components/_fonts";
app folder is set as working directory in File Watcher settings and is marked as "Resource Root" in WebStorm. However, transpiling fails with error:
error sass/index.scss (Line 3: File to import not found or unreadable: bower_components/_colors.)
I've read that #imports evaluated in SCSS
relative to current file location
relative to root location
But in my case it is obvious that Ruby transpiler doesn't do attempt to find files relative to root location. Is it a bug? Or I am doing something wrong?
I installed SCSS through Ruby and set up File Watcher according to https://www.jetbrains.com/help/webstorm/2016.1/transpiling-sass-less-and-scss-to-css.html
This is my File Watcher settings:
You will get exactly the same issue when running scss.bat in command line:
C:\Projects\prj>cd app
C:\Projects\prj\app>C:/Ruby193/bin/scss.bat --no-cache --update sass/index.scss
error sass/index.scss (Line 1: File to import not found or unreadable: bower_components/_colors.)
See https://github.com/sass/sass/issues/652: current working directory being automatically placed on the Sass load path is deprecated in 3.3. You need passing the load path explicitly with -I option to work with folders relative to the working directory. Like:

How do I access a .xul file using a chrome:// URL?

I'm learning how to make firefox extensions.
I have created a directory called findfile, under which I have the directories content/ skin/ and locale/ . There is a findfile.xul file in the content/ directory. The other two are empty
I have placed a findfile.manifest file under /home/akshay/.mozilla/firefox/xxxx.dev/chrome/
The content of findfile.manifest is:
content findfile file:///home/akshay/programs/firefox/findfile/content/
skin findfile classic/1.0 file:///home/akshay/programs/firefox/findfile/skin/
locale findfile en-US file:///home/akshay/programs/firefox/findfile/locale/
When I access findfile.xul using a file:// URL, it works fine. But when I try to access it using chrome://findfile/content/findfile.xul, it doesn't show the window. (I restarted the browser)
What am I doing wrong?
Perhaps rename the findfile.manifest to chrome.manifest ?
Also not a good idea to give absolute paths. Use relative paths instead.

Resources