GithubHelp home page GithubHelp logo

CSS and JS not minified about hugulp HOT 7 CLOSED

jbrodriguez avatar jbrodriguez commented on July 4, 2024
CSS and JS not minified

from hugulp.

Comments (7)

jbrodriguez avatar jbrodriguez commented on July 4, 2024

You're using defaults, so it expects your css and js to be in assets/styles and assets/scripts.

Is that your case ?

from hugulp.

Jip-Hop avatar Jip-Hop commented on July 4, 2024

from hugulp.

jbrodriguez avatar jbrodriguez commented on July 4, 2024

Is public/styles.css created ?

Not sure what could be the problem.

Maybe you could add gulp-debug somewhere around here https://github.com/jbrodriguez/hugulp/blob/master/gulp/build.js#L74, to figure it out

from hugulp.

Jip-Hop avatar Jip-Hop commented on July 4, 2024

Probably I'm misunderstanding something.
I've tried again, but still can't get it to work.

I'm no longer using the default .hugulprc file, but instead this one:

{
  "version": 2,
  "pipeline": [
    "images",
    "styles",
    "scripts",
    "fingerprint",
    "html"
  ],
  "path": {
    "styles": "css",
    "images": "img",
    "scripts": "js"
  },
  "watch": {
    "source": "assets",
    "target": "static"
  },
  "build": {
    "source": "public",
    "target": "public"
  },
  "autoprefixer": {
    "browsers": [
      "last 2 versions"
    ]
  },
  "cleancss": {
    "advanced": false
  },
  "htmlmin": {
    "collapseWhitespace": true
  },
  "gifsicle": {
    "interlaced": true
  },
  "jpegtran": {
    "progressive": true
  },
  "optipng": {
    "optimizationLevel": 5
  },
  "svgo": {
    "plugins": [
      {
        "removeViewBox": true
      },
      {
        "cleanupIDs": false
      }
    ]
  }
}

This is the folder structure of my project:

total 8
drwxr-xr-x   3 user  group    96 Mar 17 12:37 archetypes
-rw-r--r--@  1 user  group   468 Mar 23 09:35 config.toml
drwxr-xr-x  12 user  group   384 Mar 23 20:41 content
drwxr-xr-x   2 user  group    64 Mar 15 12:44 data
drwxr-xr-x   8 user  group   256 Mar 23 20:41 layouts
drwxr-xr-x  48 user  group  1536 Mar 25 17:22 public
drwxr-xr-x   3 user  group    96 Mar 20 16:55 resources
drwxr-xr-x  24 user  group   768 Mar 23 20:41 static
drwxr-xr-x   2 user  group    64 Mar 15 12:44 themes

And these are the contents of the static folder:

total 160
-rw-r--r--@ 1 user  group   2144 Mar 20 15:20 android-chrome-192x192.png
-rw-r--r--@ 1 user  group   5396 Mar 20 15:20 android-chrome-512x512.png
-rw-r--r--@ 1 user  group   1845 Mar 20 15:20 user-touch-icon.png
-rw-r--r--@ 1 user  group    246 Mar 20 15:20 browserconfig.xml
drwxr-xr-x  4 user  group    128 Mar 23 20:41 css
-rw-r--r--@ 1 user  group    509 Mar 20 15:20 favicon-16x16.png
-rw-r--r--@ 1 user  group    660 Mar 20 15:20 favicon-32x32.png
-rw-r--r--@ 1 user  group  15086 Mar 20 15:20 favicon.ico
-rwxr-xr-x  1 user  group    229 Sep 11  2017 humans.txt
drwxr-xr-x  7 user  group    224 Mar 23 20:41 img
drwxr-xr-x  5 user  group    160 Mar 23 20:41 js
-rw-r--r--@ 1 user  group   1670 Mar 20 15:20 mstile-144x144.png
-rw-r--r--@ 1 user  group   1556 Mar 20 15:20 mstile-150x150.png
-rw-r--r--@ 1 user  group   1718 Mar 20 15:20 mstile-310x150.png
-rw-r--r--@ 1 user  group   3007 Mar 20 15:20 mstile-310x310.png
-rw-r--r--@ 1 user  group   1240 Mar 20 15:20 mstile-70x70.png
drwxr-xr-x  3 user  group     96 Mar 23 13:11 patterns
-rwxr-xr-x  1 user  group     78 Sep 11  2017 robots.txt
-rw-r--r--@ 1 user  group   3649 Mar 20 15:20 safari-pinned-tab.svg
-rw-r--r--@ 1 user  group    452 Mar 20 15:20 site.webmanifest

public/styles.css is not being created, but that's also not where I expect my styles to be.
The original CSS is in static/css/main.css and the output ends up in public/css/main-5eb219ac99.css.
That's where I expect it to be, except the CSS isn't minified at all.

from hugulp.

jbrodriguez avatar jbrodriguez commented on July 4, 2024

In your .hugulprc, try changing

  "watch": {
-    "source": "assets",
+    "source": "static",

from hugulp.

Jip-Hop avatar Jip-Hop commented on July 4, 2024

Thanks! I get it now :)
I made an assets folder and put my css and js directories in there.
Now they're being minified.

from hugulp.

jbrodriguez avatar jbrodriguez commented on July 4, 2024

Great !

from hugulp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.