Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

it seem like cant find file #82

Open
cleverboy32 opened this issue Mar 4, 2019 · 12 comments
Open

it seem like cant find file #82

cleverboy32 opened this issue Mar 4, 2019 · 12 comments

Comments

@cleverboy32
Copy link

my config

require('postcss-assets')({
       loadPaths: ['../']
 }),

my css

src: resolve('fonts/som-ui-icons.woff?t=1472440741') format('woff'),
 resolve('fonts/som-ui-icons.ttf?t=1472440741') format('truetype');

it can complied and run, but my icon not found. i try some other features too , i aslo no use.
why - -

@borodean
Copy link
Owner

borodean commented Mar 4, 2019

@cleverboy32 do you observe any PostCSS-related errors in the console?

@cleverboy32
Copy link
Author

no . nothing console. it show Compiled successfully

@borodean
Copy link
Owner

borodean commented Mar 4, 2019

@cleverboy32 how do you see that the icon is not found?

@cleverboy32
Copy link
Author

cleverboy32 commented Mar 4, 2019

because the graph not show
i use a star icon , but the render shape is a
image

and real icon is this
image

@borodean
Copy link
Owner

borodean commented Mar 4, 2019

@cleverboy32 but what about som-ui-icons.woff font itself? Is it being loaded? Because the problem might be with the font itself.

@cleverboy32
Copy link
Author

is i use this
url('../../node_modules/@souche-ui/som-ui/src/styles/fonts/som-ui-icons.woff?t=1472440741')
it can success.

and i use reslove ,try all the prossible path, but it just no error to log, so i cant konw why

@borodean
Copy link
Owner

borodean commented Mar 4, 2019

What does the resulting CSS look like?

@cleverboy32
Copy link
Author

the css look like right
image
image

i cant see is the font file be loaded. the reason look like the file not be load.

@borodean
Copy link
Owner

borodean commented Mar 4, 2019

@cleverboy32 what about this part? How does it look like in the compiled CSS?

src: resolve('fonts/som-ui-icons.woff?t=1472440741') format('woff'),
 resolve('fonts/som-ui-icons.ttf?t=1472440741') format('truetype');

@cleverboy32
Copy link
Author

oh, it still src: resolve(...) it not be parse.

my postcss.config.js and i use webpack

module.exports = {
    plugins: [
        require('postcss-assets')({
            loadPaths: ['../../node_modules/@souche-ui/som-ui/src/styles/']
        })
    ]
}

@borodean
Copy link
Owner

borodean commented Mar 4, 2019

@cleverboy32 well, it does look to me that your file is not being processed by PostCSS at all.

By design, PostCSS Assets is never expected to keep those resolve functions intact. And if it can't resolve something an error should be thrown. Considering none of that happens I suspect that the problem is with the Webpack config itself, not with the PostCSS Assets.

Could you publish an example setup somewhere which I can use to reproduce the issue myself? I can try to help.

@cleverboy32
Copy link
Author

i did this. thank for you helping.

the post plugin i put it at the last step, and it will can parse. seem like it need the file convert totally, the plugin can Become effective。

module.exports = {
    plugins: [
        require('postcss-import')({
            resolve: createResolver({
                alias: {
                    'lemon': '@souche-ui/lemon',
                    'som-ui': '@souche-ui/som-ui'
                },
                modules: ['src', 'node_modules']
            })
        }),
        require('saladcss-bem')({
            defaultNamespace: 'som',
            separators: {
                descendent: "__"
            },
            shortcuts: {
                modifier: "m",
                descendent: "d",
                component: "c"
            }
        }),
        require('postcss-mixins'),
        require('precss'),
        require('postcss-shape'),
        require('postcss-utils'),
        require('postcss-preset-env')({
            stage: 0,
            browsers: ['ie > 8', 'iOS >= 7', 'Android >= 4.1', 'Safari >= 6']
        }),
        require('cssnano'),
        require('postcss-assets')({
            basePath: 'node_modules/@souche-ui/som-ui/src/styles',
            relative: true
        }),
    ]
};

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants