// parse.js const fs = require('fs') const util = require('util') const postcss = require('postcss') const css = fs.readFileSync('./input.css') const ast = postcss.parse(css) console.log(util.inspect(ast, false, null)) $ node parse.js Root { raws: { semicolon: false, after: '\n' }, type: 'root', nodes: [ Rule { raws: { before: '', between: ' ', semicolon: true, after: '\n' }, type: 'rule', nodes:
![PostCSSの仕組み - Qiita](https://cdn-ak-scissors.b.st-hatena.com/image/square/f56032fc09ef9c1e105bc9484e8cdd3a8f6e60b5/height=288;version=1;width=512/https%3A%2F%2Fqiita-user-contents.imgix.net%2Fhttps%253A%252F%252Fcdn.qiita.com%252Fassets%252Fpublic%252Fadvent-calendar-ogp-background-7940cd1c8db80a7ec40711d90f43539e.jpg%3Fixlib%3Drb-4.0.0%26w%3D1200%26mark64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTk3MiZoPTM3OCZ0eHQ9UG9zdENTUyVFMyU4MSVBRSVFNCVCQiU5NSVFNyVCNSU4NCVFMyU4MSVCRiZ0eHQtYWxpZ249bGVmdCUyQ3RvcCZ0eHQtY29sb3I9JTIzM0EzQzNDJnR4dC1mb250PUhpcmFnaW5vJTIwU2FucyUyMFc2JnR4dC1zaXplPTU2JnM9MzBiMjRlOWViMjk4MmI0MzRkYzMxNmMxZTc2NzgyM2U%26mark-x%3D120%26mark-y%3D96%26blend64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZoPTc2Jnc9OTcyJnR4dD0lNDBtb3Jpc2hpdHRlciZ0eHQtY29sb3I9JTIzM0EzQzNDJnR4dC1mb250PUhpcmFnaW5vJTIwU2FucyUyMFc2JnR4dC1zaXplPTM2JnR4dC1hbGlnbj1sZWZ0JTJDdG9wJnM9ZjYzZDUyYjc4MTY5MzA1NmFhYTNkMjlhZWQ0MGY1Njc%26blend-x%3D120%26blend-y%3D500%26blend-mode%3Dnormal%26s%3D950f787e75a7b1873e921a0fd1373aca)