minify - Get a timestamped URI to a minified resource using the default Minify install - minify

I am using Minify and I want a timestamped URI.
The readme.txt suggests this:
<link rel="stylesheet" type="text/css" href="<?php echo Minify_groupUri('css'); ?>" />
<script type="text/javascript" src="<?php echo Minify_groupUri('js'); ?>"></script>
but it also says:
'Before including this file, /min/lib must be in your include_path.'
Where is the include_path set??
A.

Edit your php.ini with
include_path = .:/min/lib/:

Related

How do I link files in a Codeigniter4 instance?

I am using Codeigniter4, and I am serving an html file. In this html file, I want to reference a css style sheet. I am doing it like this:
<link rel="stylesheet" href="../../public/assets/css/style.css">
I have verified that there is a style.css file in public/assets/css/style.css. When I try to run this html file, I get a 404 error. Am I doing it wrong?
When inspecting the network tab of Chrome's developer pane, I find that it is trying to load it from the following directory:http://localhost:8080/public/assets/css/style.css
You can use these three methods.
Use link_tag
echo link_tag('public/assets/css/style.css');
Or normal way
<link href="<?php echo base_url(); ?>public/assets/css/style.css" rel="stylesheet" type="text/css" />
or
echo base_url('public/assets/css/style.css');
Make sure base_url() is set in config.php $config['base_url'] = "https://stackoverflow.com//";

Codeigniter CSS not being applied to html view pages

The css is not being applied to the html views in my codeigniter project. Everything else seems to be working fine.
One answer on StackOverflow suggested removing the ?= base_url() ? part , which I Have tried but that doesn't work either,
This is the head.php file in templates, which contains the css.
Where else could the problem lie?
<head>
<?php require_once("meta.php"); ?>
<title><?= $title ?></title>
<link rel="shortcut icon" href="<?= base_url() ?>resource/images/favicon.ico" type="image/x-icon" />
<link href="<?= base_url() ?>resource/css/bootstrap.min.css" rel="stylesheet" />
<link href="<?= base_url() ?>resource/css/modern-business.css" rel="stylesheet" />
<link href="<?= base_url() ?>resource/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="<?= base_url() ?>resource/css/animate.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
I have tried removing the base part, but that doesn't work either.
<head>
<?php require_once("meta.php"); ?>
<title><?= $title ?></title>
<link rel="shortcut icon" href="<?= base_url() ?>resource/images/favicon.ico" type="image/x-icon" />
<link href="resource/css/bootstrap.min.css" rel="stylesheet" />
<link href="resource/css/modern-business.css" rel="stylesheet" />
<link href="resource/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="resource/css/animate.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
You have to recheck your configs and make sure you set your base_url correctly in your config.php so it would be something like that:
$config['base_url'] = 'http://localhost/YOUR_PROJECT_DIRECTORY/';
enable mod_rewrite and make sure your .htaccess is in your FCPATH and is as simple as this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
finally remove your index.php in your config.php if you are not using it like this:
$config['index_page'] = '';
and your ready to go, load the url_helper in your controller:
$this->load->helper(['url']);
now you can use base_url correctly wherever you want:
<link href="<?= base_url('resource/css/bootstrap.min.css') ?>" rel="stylesheet" />
Just make sure that this path is correct and inspect>console in your browser to see if it is loaded.

Having problems displaying favicon in codeigniter. Title shows the code instead

<link rel="icon" type="image/x-icon" href="<?php echo base_url().'favicon.ico'?>">Project name</title>
I have placed favicon.ico in the root folder.
But when trying to browse the page title shows the code instead with the entire link tag.
Lost of ideas on what to do.
Solution 1:
<link rel="icon" href="<?php echo base_url(); ?>favicon.ico"> <title>Project Name. </title>
Turn's out OP wrapped into <title></title>, which causing it not working.
Solution 2:
put your favicon.ico to your project root folder, then use href="favicon.ico"

Website automatically minifies? CSS changes wont appear

I have a big problem on my website.
When i am making changes to the CSS files nothing changes on the website.
It looks like my site is using a other CSS file u can see it here:
My website is using that CSS file while this CSS file is the correct one:
http://quasarwheels.com/wp-content/themes/gilbertson/style.css
I did include this in my header for getting the CSS file
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width">
<title><?php bloginfo(‘name’); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<link rel="shortcut icon" href="<?php bloginfo( 'url' ); ?>/favicon.png">
<link rel="apple-touch-icon" href="<?php bloginfo( 'url' ); ?>/favicon.png">
<link rel="stylesheet" href="<?php echo THEME_URL;?>/bootstrap/css/bootstrap.min.css">
<?php if(is_singular('frame')) {?>
<link type="text/css" rel="stylesheet" href="<?php echo THEME_URL?>/css/font-awesome.min.css" />
<link type="text/css" rel="stylesheet" href="<?php echo THEME_URL?>/css/bike-builder.css" />
<?php }?>
<link type="text/css" rel="stylesheet" href="http://quasarwheels.com/wp-content/themes/gilbertson/style.css" />
<!--[if IE]>
<style type="text/css"> #mtb, #rac, #rat, #track, #rct, #rcc{ margin-top: -55%!important;}</style>
<![endif]-->
<?php wp_enqueue_script("jquery"); ?>
<?php wp_head(); ?>
</head>
Thanks for your time!
If you inspect your page in the browser (not the header.php file) you'll see your links are being modified:
<link rel="stylesheet" href="http://quasarwheels.com/wp-content/themes/gilbertson/A.bootstrap,,_css,,_bootstrap.min.css+style.css,Mcc.KscEqGi0LS.css.pagespeed.cf.vgQu4bgNvt.css">
You can also see that several of the other stylesheets are coming from a plugin called BWP Minify. It looks like this plugin is minifying your stylesheets automatically, so you need to check the plugin settings and see if it needs refreshing or deactivating.
WordPress doesn't perform CSS minification out-of-the-box, so it's either coming from a plugin or your theme: in this instance it looks like the BWP plugin.
If you are sure you have uploaded the correct CSS file, flush your wordpress theme's cache / site cache to force the new file to be parsed and minified.
Move the
<link type="text/css" rel="stylesheet" href="http://quasarwheels.com/wp-content/themes/gilbertson/style.css" />
link to the top of the css links so it is rendered first.

HTML doesn't load webpack-built files

My build on webpack-dev-server works fine, but when I compile with NODE_ENV=production webpack --config html file outputs blank page.
In dev-server html I load files this way
<script src="http://localhost:8000/build/vendor.js"></script>
<link rel="stylesheet" type="text/css" href="http://localhost:8000/build/main.css" media="screen" />
<script src="http://localhost:8000/build/main.js"></script>
And in production html (resides in /build/):
<script type="text/javascript" src="vendor.js"></script>
<link rel="stylesheet" type="text/css" href="main.css" media="screen"/>
<script type="text/javascript" src="main.js"></script>
Configs differ in following:
Production env removes
react-hot style-loader css-loader less-loader loaders,
entries 'webpack/hot/dev-server' 'webpack-dev-server/client?http://0.0.0.0:8000', HotModuleReplacementPlugin(), #eval devtool
Production env adds:
style css less loaders, optimize.OccurenceOrderPlugin(), optimize.UglifyJsPlugin({comments: /a^/, compress: {warnings: false}}, sourcemap devtool
Thanks for help!