I just downloaded the semantic CSS and was running the examples but saw the following error on Firefox
Access to restricted URI denied
file:///C:/semanticcss/examples/fixed/fixed.less
Below is the code in the example page
<!-- Stylesheets -->
<link rel="stylesheet" href="fixed.less" type="text/less" media="screen" />
<!-- Scripts -->
<script src="../../js/less-1.1.3.min.js" type="text/javascript"></script>
How can I get rid of this error?
This is on purpose. Local files may only read other local files in the same directory or sub-directories.
See https://developer.mozilla.org/en/Same-origin_policy_for_file%3a_URIs
Try
[sudo] npm install less -g
Then it shouldn't have any problems with the directories. My system (MBP) did the same thing until I did this. The main problem was that it doesn't know where the LESS compiler is located. You will more than likely need root privileges to run the command, hence [sudo] is system dependent.
Hope this helps.
Related
Let's say that I've done a good bit of update to my css files on my dev machine (with my browser set to ignore the cache, no always seeing updates right away).
In this question and other places, I've seen the approach of adding a version number to the links:
<link type="text/css" href={% static "/path/mystyles.css?version=2" %} rel="stylesheet">,
which is fine, but on the dev machine, I get an error in the console, and the file isn't found:
GET http://127.0.0.1:8000/path/mystyles.css%3Fversion%3D2 net::ERR_ABORTED 404 (Not Found)
I've read that perhaps collectstatic will fix it on the dev side, but there's an ominous-looking warning:
You have requested to collect static files at the destination
location as specified in your settings:
/patttthhhhh/static
This will overwrite existing files!
Are you sure you want to do this?
What will happen when I run collectstatic? Where will it get files from to overwrite those?
The recommended way would be to use something like django-compressor (usage) or the likes to process your CSS into a single file and then bake a hash into the filename or dir. So that way your asset would become /mystyles.beb23fe.css.
What ended up working easily was changing the format of the version tag:
<link type="text/css" href="{% static '/path/mystyle.css' %}?version=2" rel="stylesheet">
instead of:
<link type="text/css" href={% static "/path/mystyles.css?version=2" %} rel="stylesheet">
Is fine in dev and production.
I'm new to Homestead, but not Laravel. I went through the process of setting up my new install, and was able to see the homepage welcome message.
Then I tried to enable authentication for user logins by running:
php artisan make:auth
This has worked for me outside of Homestead, but in this environment that starts the web page throwing the following error:
public/build/rev-manifest.json): failed to open stream: No such file
or directory
I've looked inside public, and there is no build folder. Should I create it? If I should create the json file, what should I put inside? And, more importantly, why am I getting this error in general?
Help appreciate!
Run npm install then gulp, to build your assets.
Otherwise you have to go to your master layout and delete Elixir helper calls (credit):
<!-- <link href="{{ elixir('css/app.css') }}" rel="stylesheet"> -->
<!-- <script src="{{ elixir('js/app.js') }}"></script> -->
I've put a css file in MyDirectoryBundle/Resources/public/css.
I then linked to it using:
<link href="{{ asset('css/main.css') }}" type="text/css" rel="stylesheet" />
I checked if it worked
short test: body {color: #FF0000;}
Nothing changed.
The parent layout (layout.twig.html) is in app/Resources/views (3 level architecture).
I still don't understand why:
css does not work
why the command: php console assets:install web/ --symlink fails
-> answer: The target directory web does not exist. (it does exist, actually).
I am quite new to symfony2 (2 weeks practice only).
I am working on Windows - just in case this may explain something...
Thank you very much for your help!
If the file first lived in MyDirectoryBundle/Resources/public/css, it'll be copied to web/bundles/mydirectory/css. So you have to include it like: {{ asset('bundles/mydirectory/css/main.css') }}.
You should execute the command from the root of your project. As you're using php console, it seems like you're in the app/ directory when executing this command. In that case, app/web/ does not exists, so the error is completely valid.
As you're on Windows, there is a change that symlink is not allowed/available. I believe it's available for admins only since Windows vista.
As a side tip, if MyDirectoryBundle is your app bundle (a bundle tied to your app and not meant to be reused by other apps), I would recommend to put the CSS file in the web/ directory directly. There is no need to put it in the bundle in such a case (this is only related to bundles that are shared, so the CSS is shared as well).
use php app/console instead of php console
I have run into a strange issue only recently and scratching my head trying to figure this out.
When compiling (saving) changes in a *.scss file, the outputted css file has its permissions change. So when previewing the page in a browser the global.css file cannot be read and the error message returned is as follows :
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<h1>Forbidden</h1>
<p>You don't have permission to access /styles/global.css
on this server.</p>
</body>
</html>
This is when looking at the file global.css via Firebug.
Using terminal I can change the file permissions with something along the lines of:
sudo chmod -R 775 htdocs
Then things work fine until I do a recompile. And the file permission properties changes again.
I have tried many things to fix this issue with no success :
These include
compass clean
and accessing MAMP and changing my permissions this way. I have also tried deleting the folder and starting again a new. I have uninstalled compass and sass and reinstalled, and still the issue exists.
Also as a note the scss permissions don't change but only the compiled css file. I don't know if this helps?
I was unable to install a module using Magento Connect, getting a Connection Error try again later error. Following the instructions of the module developer I attempted to fix permissions in the document root with:
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod o+w var var/.htaccess app/etc
chmod 550 mage
chmod -R o+w media
It still didn't work so I ended up installing the module manually. I then logged into the admin backend and Magento was trying serve CSS files using the system file paths instead of URLs like so:
<link rel="stylesheet" type="text/css" href="/home/user/public_html/js/calendar/calendar-win2k-1.css" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/reset.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/boxes.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/custom.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/xmlconnect/boxes.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/print.css" media="print" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/menu.css" media="screen, projection" />
I immediately removed the extension and tried to match the perms from another server with a working Magento to no avail. I have also:
Cleared local, APC, and Magento caches
Looked in error logs (logging is enabled)
double-checked proper values of web/unsecure/base_url and web/secure/base_url in the DB
Rebooted, 3 times ;)
Minify is not being used. Merge CSS files are enabled, however I cannot figure out how to disable without the admin interface (save and navigation isn't working, even when I replace the correct values with Firebug). Any ideas would be greatly appreciated!
EDIT: As mentioned by #michael-hampton, this solution opens a serious security hole and shouldn't be used. Please don't use in production!
I ran into the same problem, and it happens that file permissions were not set properly.
In order to allow Magento to generate assets files, media directory must be writable by apache user.
So doing
chmod -R o+w media
will not necessarily allow apache to write in media directory, if apache don't own this directory.
You should check that apache actually own media directory, by checking first which user apache is running as, and then ajust permissions accordingly :
chown -R <apache_user> media
chmod -R o+w media
More information here: Magento Filesystem Permissions
A much simpler approach is to just head over to magento database and alter the table core_config_data manually. There should be an entry named dev/js/merge_files and dev/css/merge_files.
These two should hold values of 1.By setting these two values to 0, you'll get this fixed and your css and js files should be loadable again. tested in magento 1.5.x.
I ended up fixing it by being able to disable CSS merge by browsing to the relevant admin page and entering configForm.submit() in my java console to save the settings.
Not sure why CSS merge started using the file system paths of all a sudden, I wasn't changing anything associated with that (the module I was installing was for invoices). I've had a lot of randoms problem like this with Magento, it seems to require constant tinkering. I definitely am hesitant to recommend another client go with Magento again.
If you're using Fooman Speedster, just uninstall it from the Magento Connect Package Manager. Then, reinstall it.
Don't use the reinstall feature in the package manager, because it will not work.
Sometimes, you need to make sure that you have the media folder in your Magento root directory.