0

I watched the video tutorial Laravel 9 and Vue 3 SPA online store 11. Transferring the html store template to App vue. In it, the server part is made on Laravel, and the client part on Vue.

I downloaded the layout of the client part of the online store - HTML template of the client part of the online store from Course Laravel 9 and Vue 3 SPA online store 0. Overview of the html store template and task priorities in the description under the video.

Copied the contents of the file C:\OpenServer\domains\karteecommerce\karte-fashion-multipurpose-ecommerce-html-template\index. html to the C:\Openserver\domains\clientpart\public\index.html file of the vue clientpart project (as in the video). Copied the folder (with styles, fonts and pictures) C:\OpenServer\domains\karteecommerce\karte-fashion-multipurpose-ecommerce-html-template\assets instead of C:\Openserver\domains\clientpart\src\assets.

The assets folder in the karte-fashion-multipurpose-ecommerce-html-template directory has the following location relative to the karte-fashion-multipurpose-ecommerce-html-template\index.html file

assets original

The structure of the project, as can be seen from the screenshot below, is as follows

project structure

Changed all paths starting with assets to ../src/assets (in C:\Openserver\domains\clientpart\public\index.html) and got the following file

<!DOCTYPE html>
<html lang="en">

<head>
  <!-- Required Meta -->
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <!-- Title For This Document -->
  <title> Karte - Multipurpose E-Commerce Html Template</title>
  <!-- Favicon For This Document -->
  <link rel="shortcut icon" href="../src/assets/images/logo/favicon-32x32.png" type="image/x-icon">
  <!-- Bootstrap 5 Css -->
  <link rel="stylesheet" href="../src/assets/css/bootstrap.5.1.1.min.css">
  <!-- Google fonts -->
  <link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@300;400;500;600;700&family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
  <!-- FlatIcon Css -->
  <link rel="stylesheet" href="../src/assets/fonts/flaticon.css">

  <!-- Slick Slider Css -->
  <link rel="stylesheet" href="../src/assets/css/plugin/slick.css">
  <!--  Ui Tabs Css -->
  <link rel="stylesheet" href="../src/assets/css/plugin/jquery-ui.min.css">
  <!-- Magnific-popup Css -->
  <link rel="stylesheet" href="../src/assets/css/plugin/magnific-popup.css">
  <!-- Nice Select Css -->
  <link rel="stylesheet" href="../src/assets/css/plugin/nice-select.v1.0.css">
  <!-- Animate Css -->
  <link rel="stylesheet" href="../src/assets/css/plugin/animate.css">
  <!-- Style Css -->
  <link rel="stylesheet" href="../src/assets/css/style.css">

</head>

<body class="shoe">
  <!-- ==========Preloader========== -->
  <div class="loader"><span>Karte...</span></div>
  <!-- ==========Preloader========== -->
  <!--===scroll bottom to top===-->
  <a href="#0" class="scrollToTop"><i class="flaticon-up-arrow"></i></a>
  <!--===scroll bottom to top===-->

  <div id="app"></div>
  <!--==== Js Scripts Start ====-->
  <!-- Jquery v3.6.0 Js -->
  <script src="../src/assets/js/jquery.v3.6.0.min.js"></script>
  <!-- Popper v2.9.3 Js -->
  <script src="../src/assets/js/popper.v2.9.3.min.js"></script>
  <!-- Bootstrap v5.1.1 js -->
  <script src="../src/assets/js/bootstrap.v5.1.1.min.js"></script>
  <!-- jquery ui js -->
  <script src="../src/assets/js/plugin/jquery-ui.min.js"></script>
  <!-- Parallax js -->
  <script src="../src/assets/js/plugin/jarallax.min.js"></script>
  <!-- Isotope js -->
  <script src="../src/assets/js/plugin/isotope.js"></script>
  <!-- Slick Slider Js -->
  <script src="../src/assets/js/plugin/slick.min.js"></script>
  <!-- magnific-popup v2.3.4 Js -->
  <script src="../src/assets/js/plugin/jquery.magnific-popup.min.js"></script>
  <!-- Tweenmax v2.3.4 Js -->
  <script src="../src/assets/js/plugin/tweenMax.min.js"></script>
  <!-- Nice Select Js -->
  <script src="../src/assets/js/plugin/nice-select.v1.0.min.js"></script>
  <!-- Wow js -->
  <script src="../src/assets/js/plugin/wow.v1.3.0.min.js"></script>
  <!-- Wow js -->
  <script src="../src/assets/js/plugin/jquery.countdown.min.js"></script>
  <!-- Main js -->
  <script src="../src/assets/js/main.js"></script>
  <!--==== Js Scripts End ====-->

  <script type="module" src="../src/main.js"></script>
</body>

</html>

The page looks like this

page view

And it should look like

need page view

The App.vue file contains the content and all images starting with ../src/assets/images are rendered normally, and the styles included in public/index.html with `../src/assets/ css' didn't work.

Tell me how to achieve the inclusion of css files and thus the correct display of the page.

P.S. In the video tutorial, the index.html file is located at C:\Openserver\domains\clientpart\index.html instead of C:\Openserver\domains\clientpart\public\index.html. I'm not sure if it affected, but I wrote it just in case.

P.S. Here are screenshots of the developer tools (in which you can see the connection of css files in the lower right corner) - as it should be and as it is

devtools1

devtools2

P. S. Add errors

error1

errors2

Suggest solution for Vue, on Stackoverflow link given solution for Node.js.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • href="../src/assets/css/plugin/nice-select.v1.0.css" - these are the mistakes. `src` isn't supposed to be served by web server. Files from src/assets are supposed to be imported in Vue app. If they should be loaded from html for some reason, they should be located in web public folder, and don't use relative paths – Estus Flask Sep 14 '22 at 13:24
  • @EstusFlask How can I import files from src/assets into a Vue app? The structure of the Vue application is shown in the screenshot in the question. – vladwebsearch Sep 14 '22 at 13:34
  • The question lacks https://stackoverflow.com/help/mcve , you shouldn't post code as images, https://meta.stackoverflow.com/questions/285551 . Check https://stackoverflow.com/help/how-to-ask . It's unclear what you're trying to do exactly, Vue app is not shown. Vue app is supposed to be built, there's no other way if you use .vue files. And you import assets inside the app, e.g. https://stackoverflow.com/questions/43784202/how-to-include-css-files-in-vue-2 . Everything inside `src` is supposed to be built before it's deployed to web server, at least that's how it works in regular Vue setups – Estus Flask Sep 14 '22 at 15:21

0 Answers0