Activating development mode for LessCSS in Node.js

I'm encountering some major difficulties identifying LESS parse errors within a large CSS compilation.

The error messages aren't providing much help (at least not for me).

Here are my questions:

1. Is there a method to activate more debugging information during the LESS parsing process in NodeJS?

2. If the current error block is the only available resource, how can you interpret the data? The line numbers don't appear to align correctly, etc.

To clarify, I am referring to error outputs similar to this:

{ name: 'ParseError',
  message: 'Syntax Error on line 460',
  index: 13409,
  filename: null,
  line: 460,
  column: 0,
  extract: [ '    }', '}', '' ] }

Currently, I have multiple source LESS files that are combined into one before being processed by the parser. As a result, it terminates and cuts off everything after the problematic location.

Any recommendations would be greatly valued. Thank you.

Answer №1

If there is an error in your LESS file, such as a name or parse error, then your LESS code will fail to compile altogether.

It is not recommended to use client-side compiling (via less.js) for production, especially if performance is a priority. However, using client-side compiling for development and testing makes it easy to set up debug messages.

To enable debug mode, add

<script type="text/javascript">less = { env: 'development' };</script>
to your HTML file:

<script type="text/javascript>less = { env: 'development' };</script>
<script type="text/javascript" src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/js/less-1.5.0.min.js"></script>

Once this is done, your browser will display an error message if your LESS file contains any errors.

For more information on debugging, visit:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips on effectively utilizing Knex and Bookshelf in conjunction with MySQL on AWS RDS

My current setup involves a Node.js application that interacts with a MySQL database on an AWS RDS using the Bookshelf and Knex libraries. The RDS Instance is set with a maximum connection limit of 90. Below is the connection object I am utilizing: knex: ...

Enhancing Icons with Badges in Bootstrap

Does anyone know how to properly position a badge on top of an icon without it appearing to the right? Check out this screenshot: https://i.sstatic.net/z1Apj.png This is the code I am using: <li class="nav-item mr-3"> <a href=&quo ...

auto-scrolling webpage as elements come into view

Here is some jQuery code I have: $(".col-md-12").hide(); $(".button-div").hide(); $(".featurette-divider").hide(); $(".footer").hide(); $(".first").fadeIn(1000); $(".second").delay(900).fadeIn(1000); $(".third").delay(1800).fadeIn(1000); $(".fourth").dela ...

The challenges of positioning HTML li elements in a floating layout

Check out my website: . I'm having an issue with the layout where two <li> elements are stacked on top of each other and one is floating next to them, but it's only floating next to the second one. How can I make it float next to the first ...

"Encountering a halt in my Node.js Application as it waits endlessly

I'm currently following a tutorial on creating a collaborative canvas drawing application using Node.js and Socket.io. I've included the source file below which is used to create the server. However, when I try to open it in my browser, it gets s ...

Establish a vertical column that matches the height of its parent element

Is there a way to create a column that matches the height of its parent element? I have a navbar followed by a container with three columns. The challenge is to make the last right column the same height as its parent and also scrollable. In this scenario, ...

npm fails to show prompts properly when used with emacs eshell

There seems to be an issue with the Node.js prompt not showing up in eshell, as discussed in this Stack Overflow thread. The solution provided in that thread works for the node repl, but not when calling node from npm. For example, running: $ npm init Th ...

Tips on aligning two divs horizontally on the same line

doc.html .column { background-color: orange; width: 75%; vertical-align: top; display: inline-block; height: 200px; } .nav { vertical-align: top; display: inline-block; width: 25%; background-color: lightgreen; height: 200px; } * { ...

Is there a way to make Forever write to a new log file on a daily basis?

I am managing a group of production servers that run a Node.JS application using Forever. It seems like my current log file options are limited: Allowing Forever to handle logging on its own, resulting in logs being saved to ~/.forever/XXXX.log Specifyin ...

Ways to adjust flex division to occupy the entire height of its container

https://i.sstatic.net/4YInI.png https://i.sstatic.net/hu8mG.png https://i.sstatic.net/Q51ha.png I am looking to activate an onClick event on the body where discussions and icons are located. While triggering onClick on the body itself poses no issue, I a ...

Is it possible for the 'error' event to be triggered on the 'http.IncomingMessage' object during a node.js http.request?

There are 4 ways to encounter errors when calling http.get(url, cb): httpThrows() This error can occur due to a wrong format of the url or incorrect callback. function httpThrows() { try { http.get("www.missing-protocol.com", res => { ...

What is the best way to extend the expiration time of the 'appSession' cookie that is created after OIDC login within the 'express-oidc-connect' library?

At the moment, the expiry time for the **appSession** cookie that is created in the browser upon successful user login is set to around 24 hours. I am looking to extend this to 30 days. I have attempted to include the maxAge parameter in the login method ...

Timezone conversion in Moment Timezone JS works perfectly on a development environment, but gives incorrect results in production

After conducting a time conversion between the original time zone 'Asia/Jakarta' (GMT+7) and 'Asia/Tokyo' (JST), I discovered that there is a 2-hour difference (GMT+7 00:00, JST 02:00). When tested in development, the result was accurat ...

The conflict arises when importing between baseUrl and node_modules

I am currently working on a TypeScript project with a specific configuration setup. The partial contents of my tsconfig.json file are as follows: { "compilerOptions": { "module": "commonjs", "baseUrl": &quo ...

"You do not have the necessary permissions to view this content": Utilizing ACL Middleware in Mongoose and Express Framework

Trying to implement ACL middleware for route authentication. Specifically, setting up to check for 'admin' permission for the user (myself). Here's the route setup: // Setting up the home page route router.get('/', acl.middleware ...

How can you fix the problem of a failed Npm package installation and revert back to the previous working version

Having issues with npm failing to install new versions and instead deleting old ones is quite frustrating. Is there a way to revert back to the previous version of the package that was working fine? This error message keeps popping up: gulp -bash: /usr/ ...

Submitting a form via email without the need for PHP

Currently, I am focusing on a project that is small and emphasizes presentation more than security. The main objective is to create a form where users can input data, then click submit for all the information gathered to be sent to a specified 'mailt ...

The client is not recognized in the websocket server

When I use console.log to print client like console.log(), it returns undefined. I believe there is something missing in my client code, but I'm not sure what. Your Server Code: const WebSocket = require('ws'); const wss = new WebSocket.Se ...

Tips for implementing a switch-case statement with variable formats that may not always be

switch (req.path) { case "/api/posts": console.log("posts"); break; case "/api/posts/tags/*": // the part * is always changing depending on user input console.log("tags"); break; case "/api/best": console.log ...

An easy way to enable mobility for BootstrapDialog on mobile devices

Currently, I am utilizing the library available at https://github.com/nakupanda/bootstrap3-dialog in order to create a dialog box. However, my issue arises when viewing the dialog on mobile devices where it exceeds the screen size. On desktops, adjusting t ...