Combine CSS files in a specific sequence

In my project, I have multiple CSS files being generated in the css/ folder using libsass. Additionally, I already have a normalize.css file placed in the same directory to ensure consistent styling across different browsers. As part of my build process, which is powered by npm, my package.json includes the following scripts:

{
.....
"scripts": {
    "test": "npm run lint",
    "lint": "csslint css/*.css",
    "build": "node-sass sass/ -o css/",
    "postbuild": "cat css/*.css | cleancss -o css/main.min.css"
  },
.....
}


During the build step, individual CSS files are generated, and then during the post-build step, they are concatenated into one minified CSS file. However, I am facing an issue where the content of normalize.css is not consistently placed at the beginning of the concatenated file as expected. I want to ensure that the normalization styles come before any other CSS rules. Any suggestions on how to achieve this would be greatly appreciated.


Tldr- When concatenating CSS files, normalize.css is sometimes appended in the middle or end instead of the beginning. I need it to be at the start of the concatenated file.

Thank you.

Answer №1

To avoid listing normalize.css, you can utilize the -I option with the ls command like this:

cd css/ && cat normalize.css `ls -I normalize.css -I main.min.css` | cleancss -o main.min.css

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 for creating a wide mobile menu

I am attempting to make the mobile menu full width, but so far my efforts have been unsuccessful. #menu-main-2 { background-color:#FFFFFF !important; padding-left:15px; max-width: unset; width: 100%; } view mobile menu ...

Text in anchor vertically centered across browsers

Take a look at my JsFiddle project here: http://jsfiddle.net/JxXHE/ I want to ensure that the text in the menu items is perfectly centered vertically, with an 8px margin from the top and bottom in all browsers that are supported. The list of supported bro ...

How about designing a button with a dual-layered border for a unique touch

Looking for a specific button: My attempted CSS code that's not working: button { font-family: 'Ubuntu', sans-serif; font-size: 1em; font-weight: bold; color: white; border: 3px double #f26700; background: #f26700; ...

What are the steps to developing a responsive tile using HTML and CSS?

I am exploring the functionalities of CSS and responsive design. To better understand how it works, I created a simple example which can be accessed here. This demonstration showcases a basic tile template. My goal is to display my tiles in 2, 3, 4, or m ...

Edit the alternative text for an image tag to suit your needs

Is there a way to move the displayed mini popup to the left of the mouse cursor when a user hovers over an image with the following code: <img src="image" alt="product code 000000"> I noticed that the default alt text always appears on the right of ...

Do you think it's achievable to modify the color using CSS's order attribute?

When I look at the code in Firefox's inspector, I notice this : element { order:35; } Can a color be assigned to it? I am customizing my year outlook calendar and have set a particular day to display in a different color. But when I click on the mo ...

Finding and removing a specific CSS pattern from a webpage that has been loaded

Encountered a troublesome Amazon.com page that appears blank in print preview, specifically the Online Return Center\Your Return Summary page. After much troubleshooting on a locally saved copy of the webpage, I pinpointed the issue to a problematic l ...

Initiate a CSS animation by defining a series of keyframes, followed by seamlessly transitioning into another set of keyframes to

Is it possible to create an animation that starts with one CSS keyframe set and then transitions into looping another keyframe set indefinitely? ...

The styles defined in CSS do not have an impact on EJS templates that have GET route paths stacked

I have a CSS file located in the public directory and two EJS templates in the views directory. The CSS file works fine when using this route: app.get('/theresa', (req, res) => { res.render('templates/home') }) However, when I ...

Positioning an image beneath the navigation bar in Bootstrap and CSS without it getting covered by text

I am having difficulty positioning an image below the navbar without it overlapping with the text in the navbar. No matter what I try in my code, the image remains attached to the bottom of the navbar and won't move to a separate row below it. I hav ...

What is the best way to ensure uniform header height on cards or similar elements using flexbox?

Avoid using hacks Do not hard code the solution. The goal is to create a solution that works for dynamic content and responsive screen sizes, rather than just one specific case. The issue lies in the fact that the headers are not direct children of the e ...

How can I change the background color of the initial word in a textbox?

In my HTML, I have a text box input. While I am familiar with how to use CSS to set the background color of the entire textbox using background-color, I am wondering if it is possible to specifically target and change the background color of only the first ...

Is there a way to position the icon in the top left corner within the image using Vue and CSS?

I am currently working on a Vue project and I am attempting to create a row of images with an icon positioned at the top left corner of each image. Here is my code snippet: <div v-for="(image, index) in images" :key="index" class=&q ...

Error: Invalid version number "y" detected in npm package

After installing nodejs on my windows 7 operating system using the msi file from https://nodejs.org/en/download/, I have node version v6.11.3 (includes npm 3.10.10) Attempting to start my app with npm start I encountered the following error: D:\de ...

Dynamically route a link from a React App to an Express server

Trying to connect a React JS app front end link to an Express server has been a challenge for me. Here's an Example: <a href="/pages">Pages</a> For the Express server, I included this code: app.get('/pages', (req, res) => ...

Tips for adjusting the position of the second child in my navigation menu using CSS

Struggling with customizing my navigation menu in CSS, I'm seeking assistance. My goal is to have the second child element of the navigation menu on a new line instead of below the first child (refer to the image for clarification). An example of the ...

What process does npm use to identify when a package version has become vulnerable and display it in the command prompt?

As I dive into my react project, relying on various npm packages, I encountered a concerning issue. Initially, there were 1002 vulnerable packages that needed fixing or updating. After some effort, only 20 vulnerabilities remained, and they were deemed low ...

Switch up the component's style based on the route being accessed

Is there a way to dynamically load CSS styles in a component based on URL parameters? The idea is that the user will access the page using a URL structure like SOME_URL/{screenSize}/{type}. While the component remains the same, the CSS styling should chang ...

When a container is styled with 'overflow-y: auto', it will display additional horizontal and vertical scrolling bars

I have two files, one HTML and one CSS. The HTML file contains the following code: <div class="app"> <div class="header"></div> <div class="main"> <div class="container_1"> ...

Aligning the row div in the center horizontally

Is there a way to center all columns in a row horizontally in Bootstrap 4? The first row is centered correctly, but the columns in the second row are not aligned properly even though they have the same class. Here's my code: <!doctype html> &l ...