Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCSS 'WebP' image load #6526

Closed
Gusachenko opened this issue Jun 1, 2017 · 2 comments
Closed

SCSS 'WebP' image load #6526

Gusachenko opened this issue Jun 1, 2017 · 2 comments
Assignees
Labels
effort1: easy (hours) feature Issue that requests a new feature help wanted

Comments

@Gusachenko
Copy link
Contributor

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Versions.

    "@angular/compiler-cli": "4.0.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "autoprefixer": "^6.5.3",
    "codelyzer": "~2.0.0",
    "css-loader": "^0.27.3",
    "cssnano": "^3.10.0",
    "exports-loader": "^0.6.3",
    "file-loader": "^0.10.0",
    "istanbul-instrumenter-loader": "^2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "json-loader": "^0.5.4",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-sourcemap-loader": "^0.3.7",
    "less-loader": "^4.0.2",
    "postcss-loader": "^1.3.3",
    "postcss-url": "^5.1.2",
    "protractor": "~5.1.0",
    "raw-loader": "^0.5.1",
    "sass-loader": "^6.0.3",
    "script-loader": "^0.7.0",
    "source-map-loader": "^0.1.5",
    "style-loader": "^0.13.1",
    "stylus-loader": "^3.0.1",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
    "typescript": "~2.2.0",
    "url-loader": "^0.5.7",
    "webpack-dev-server": "~2.4.2"

Repro steps.

styles.scss

.earth {
    ...
    background: url("src/assets/earthSpin1.webp") left center;
    ...
}

.angular-cli.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "geoasfront",
    "ejected": false
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "styles.scss"
      ],
      "scripts": [  ],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json"
    },
    {
      "project": "src/tsconfig.spec.json"
    },
    {
      "project": "e2e/tsconfig.e2e.json"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "scss",
    "component": {
    }
  }
}

run

ng build --prod --output-hashing none

The log given by the failure.

ERROR in ./src/assets/earthSpin1.webp
Module parse failed: C:\GISTORIS\Solution\Iac.Toris.Gis.Web2\frontend\src\assets\earthSpin1.webp Unexpected character '�' (1:4)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
 @ ./src/styles.scss 18:232-284
 @ multi ./src/styles.scss

Desired functionality.

Need to enable WebP image format to default loader.

Mention any other details that might be useful.

All working fine (but whithout ng) if eject webpack.config.js and edit it like that:

...
      {
        "test": /\.(jpg|png|webp|gif|otf|ttf|woff|woff2|cur|ani)$/,
        ...
      },
...
@filipesilva
Copy link
Contributor

Would you be available to do a PR adding that change to https://github.com/angular/angular-cli/blob/master/packages/@angular/cli/models/webpack-configs/common.ts?

This change doesn't need a test.

@filipesilva filipesilva self-assigned this Jun 1, 2017
@filipesilva filipesilva added feature Issue that requests a new feature help wanted effort1: easy (hours) labels Jun 1, 2017
Gusachenko added a commit to Gusachenko/angular-cli that referenced this issue Jun 1, 2017
Gusachenko added a commit to Gusachenko/angular-cli that referenced this issue Jun 6, 2017
dond2clouds pushed a commit to d2clouds/speedray-cli that referenced this issue Apr 23, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort1: easy (hours) feature Issue that requests a new feature help wanted
Projects
None yet
Development

No branches or pull requests

2 participants